mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2026-01-31 23:41:29 +08:00
feat: Project Euler Problem 17 (#1168)
This commit is contained in:
14
Project-Euler/test/Problem017.test.js
Normal file
14
Project-Euler/test/Problem017.test.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { countNumberWordLength } from '../Problem017.js'
|
||||
|
||||
describe('Number letter count', () => {
|
||||
test.each([[5, 19], [100, 864], [1000, 21124]])('Number letter count from 1 to %i', (n, expected) => {
|
||||
expect(countNumberWordLength(n)).toBe(expected)
|
||||
})
|
||||
|
||||
test.each([
|
||||
['test', 'Invalid input, please provide valid number'],
|
||||
[0, 'Please provide number greater that 1']
|
||||
])('Should throw an error for input %i', (n, expected) => {
|
||||
expect(() => countNumberWordLength(n)).toThrowError(expected)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user