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