diff options
Diffstat (limited to 'javascript/resistor-color/resistor-color.spec.js')
-rw-r--r-- | javascript/resistor-color/resistor-color.spec.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/javascript/resistor-color/resistor-color.spec.js b/javascript/resistor-color/resistor-color.spec.js new file mode 100644 index 0000000..e403129 --- /dev/null +++ b/javascript/resistor-color/resistor-color.spec.js @@ -0,0 +1,32 @@ +import { colorCode, COLORS } from './resistor-color'; + +describe('ResistorColor', () => { + describe('Color codes', () => { + test('Black', () => { + expect(colorCode('black')).toEqual(0); + }); + + test('White', () => { + expect(colorCode('white')).toEqual(9); + }); + + test('Orange', () => { + expect(colorCode('orange')).toEqual(3); + }); + }); + + test('Colors', () => { + expect(COLORS).toEqual([ + 'black', + 'brown', + 'red', + 'orange', + 'yellow', + 'green', + 'blue', + 'violet', + 'grey', + 'white', + ]); + }); +}); |