Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions exercises/practice/resistor-color/.meta/template.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% macro assertion(case) -%}
{%- if case["property"] == "colors" -%}
expect({{ exercise_name | remove_spaces }}.colors()).toEqual {{ case["expected"] | format_multiline_list }}
{%- else -%}
expect({{ exercise_name | remove_spaces }}.colorCode {{ case["input"]["color"] | quote }}).toEqual {{ case["expected"] | quote }}
{%- endif -%}
{%- endmacro %}
{{ header }}

{{ exercise_name | remove_spaces }} = require './{{ exercise_slug }}'

describe {{ exercise_name | quote }}, ->
{% for case in cases %}
{{ case["test_keyword"] }} {{ case["description"] | quote }}, ->
{{ assertion(case) | indent(4, true) }}

{% endfor %}
50 changes: 23 additions & 27 deletions exercises/practice/resistor-color/resistor-color.spec.coffee
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/blob/main/exercises/resistor-color/canonical-data.json
# File last updated on 2026-11-05T15:54:19+00:00

ResistorColor = require './resistor-color'

describe 'ResistorColor', ->
it 'Black', ->
results = ResistorColor.colorCode('black')
expected = 0
expect(results).toEqual expected
describe "Resistor Color", ->
it "Black", ->
expect(ResistorColor.colorCode "black").toEqual 0

xit 'White', ->
results = ResistorColor.colorCode('white')
expected = 9
expect(results).toEqual expected
xit "White", ->
expect(ResistorColor.colorCode "white").toEqual 9

xit 'Orange', ->
results = ResistorColor.colorCode('orange')
expected = 3
expect(results).toEqual expected
xit "Orange", ->
expect(ResistorColor.colorCode "orange").toEqual 3

xit 'Colors', ->
results = ResistorColor.colors()
expected = [
'black'
'brown'
'red'
'orange'
'yellow'
'green'
'blue'
'violet'
'grey'
'white'
xit "Colors", ->
expect(ResistorColor.colors()).toEqual [
"black"
"brown"
"red"
"orange"
"yellow"
"green"
"blue"
"violet"
"grey"
"white"
]
expect(results).toEqual expected
Loading