2023-02-01 15:53:54 -08:00
|
|
|
const fibonacci = require('./fibonacci-solution');
|
2022-02-20 11:07:44 -08:00
|
|
|
|
2023-02-01 15:53:54 -08:00
|
|
|
describe('fibonacci', () => {
|
|
|
|
test('4th fibonacci number is 3', () => {
|
2023-01-21 09:53:41 -08:00
|
|
|
expect(fibonacci(4)).toBe(3);
|
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('6th fibonacci number is 8', () => {
|
2023-01-21 09:53:41 -08:00
|
|
|
expect(fibonacci(6)).toBe(8);
|
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('10th fibonacci number is 55', () => {
|
2023-01-21 09:53:41 -08:00
|
|
|
expect(fibonacci(10)).toBe(55);
|
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('15th fibonacci number is 610', () => {
|
2023-01-21 09:53:41 -08:00
|
|
|
expect(fibonacci(15)).toBe(610);
|
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('25th fibonacci number is 75025', () => {
|
2023-01-21 09:53:41 -08:00
|
|
|
expect(fibonacci(25)).toBe(75025);
|
|
|
|
});
|
2023-05-19 23:22:12 -07:00
|
|
|
test('0th fibonacci number is o', () => {
|
|
|
|
expect(fibonacci(0)).toBe(0);
|
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test("doesn't accept negatives", () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(fibonacci(-25)).toBe('OOPS');
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('DOES accept strings', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(fibonacci('1')).toBe(1);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('DOES accept strings', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(fibonacci('2')).toBe(1);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('DOES accept strings', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(fibonacci('8')).toBe(21);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2022-02-20 11:07:44 -08:00
|
|
|
});
|