| Total Complexity | 2 |
| Complexity/F | 1 |
| Lines of Code | 35 |
| Function Count | 2 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { expect, describe, it } from '@jest/globals'; |
||
| 2 | import { capitalizeWords } from '../string-helper.js'; |
||
| 3 | |||
| 4 | const testCases = [ |
||
| 5 | { |
||
| 6 | description: 'It should capitalize words', |
||
| 7 | input: 'test', |
||
| 8 | expectedResult: 'Test', |
||
| 9 | }, |
||
| 10 | { |
||
| 11 | description: 'It should capitalize "test_test_test"', |
||
| 12 | input: 'test_test_test', |
||
| 13 | expectedResult: 'TestTestTest', |
||
| 14 | }, |
||
| 15 | { |
||
| 16 | description: 'It should capitalize "test test test"', |
||
| 17 | input: 'test test test', |
||
| 18 | expectedResult: 'TestTestTest', |
||
| 19 | }, |
||
| 20 | { |
||
| 21 | description: 'It should capitalize "tEst teSt tesT"', |
||
| 22 | input: 'tEst teSt tesT', |
||
| 23 | expectedResult: 'TEstTeStTesT', |
||
| 24 | }, |
||
| 25 | ]; |
||
| 26 | |||
| 27 | describe.each(testCases)( |
||
| 28 | 'Test the item filter method', |
||
| 29 | ({ description, input, expectedResult }) => { |
||
| 30 | it(description, () => { |
||
| 31 | const result = capitalizeWords(input); |
||
| 32 | expect(result).toEqual(expectedResult); |
||
| 33 | }); |
||
| 34 | } |
||
| 35 | ); |
||
| 36 |