Files
JavaScript/Dynamic-Programming/tests/FastFibonacciNumber.test.js
2022-10-17 01:54:44 +05:30

24 lines
518 B
JavaScript

import { fastFibonacci } from '../FastFibonacciNumber'
describe('Testing FibonacciNumber', () => {
const errorCases = ['0', '12', true]
test.each(errorCases)('throws an error if %p is invalid', (input) => {
expect(() => {
fastFibonacci(input)
}).toThrow()
})
const testCases = [
[0, 0],
[1, 1],
[10, 55],
[25, 75025],
[40, 102334155]
]
test.each(testCases)('if input is %i it returns %i', (input, expected) => {
expect(fastFibonacci(input)).toBe(expected)
})
})