feat: Project Euler Problem 17 (#1168)

This commit is contained in:
Chetan Patil
2022-10-13 10:42:56 +02:00
committed by GitHub
parent 564ee8527a
commit 5a6b1d0d9e
2 changed files with 131 additions and 0 deletions

View 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)
})
})