|
| 1 | +const convertColor = require('../../_filters/convertColor'); |
| 2 | + |
| 3 | +describe('blank', () => { |
| 4 | + test('should export module as a function', () => { |
| 5 | + expect(typeof convertColor).toBe('function'); |
| 6 | + }); |
| 7 | + |
| 8 | + test.each([ |
| 9 | + { value: '#000000', format: 'RGB', expected: '0,0,0' }, |
| 10 | + { value: '#FFFFFF', format: 'RGB', expected: '255,255,255' }, |
| 11 | + { value: '#FF0000', format: 'RGB', expected: '255,0,0' }, |
| 12 | + { value: '#00FF00', format: 'RGB', expected: '0,255,0' }, |
| 13 | + { value: '#0000FF', format: 'RGB', expected: '0,0,255' }, |
| 14 | + ])('should return RGB when input is: %s', ({ value, format, expected }) => { |
| 15 | + expect(convertColor(value, format)).toBe(expected); |
| 16 | + }); |
| 17 | + |
| 18 | + test.each([ |
| 19 | + { value: '#000000', format: 'CMYK', expected: '0,0,0,100' }, |
| 20 | + { value: '#FFFFFF', format: 'CMYK', expected: '0,0,0,0' }, |
| 21 | + { value: '#FF0000', format: 'CMYK', expected: '0,100,100,0' }, |
| 22 | + { value: '#00FF00', format: 'CMYK', expected: '100,0,100,0' }, |
| 23 | + { value: '#0000FF', format: 'CMYK', expected: '100,100,0,0' }, |
| 24 | + { value: '#00FFFF', format: 'CMYK', expected: '100,0,0,0' }, |
| 25 | + { value: '#FF00FF', format: 'CMYK', expected: '0,100,0,0' }, |
| 26 | + { value: '#FFFF00', format: 'CMYK', expected: '0,0,100,0' }, |
| 27 | + ])('should return CMYK when input is: %s', ({ value, format, expected }) => { |
| 28 | + expect(convertColor(value, format)).toBe(expected); |
| 29 | + }); |
| 30 | +}); |
0 commit comments