2023-09-18 21:11:09 +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-09-18 21:11:09 +00:00
|
|
|
test('6th fibonacci number is 8', () => {
|
2023-01-21 17:53:41 +00:00
|
|
|
expect(fibonacci(6)).toBe(8);
|
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('10th fibonacci number is 55', () => {
|
2023-01-21 17:53:41 +00:00
|
|
|
expect(fibonacci(10)).toBe(55);
|
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('15th fibonacci number is 610', () => {
|
2023-01-21 17:53:41 +00:00
|
|
|
expect(fibonacci(15)).toBe(610);
|
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('25th fibonacci number is 75025', () => {
|
2023-01-21 17:53:41 +00:00
|
|
|
expect(fibonacci(25)).toBe(75025);
|
|
|
|
});
|
2023-05-20 06:22:12 +00:00
|
|
|
test('0th fibonacci number is o', () => {
|
|
|
|
expect(fibonacci(0)).toBe(0);
|
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('doesn\'t accept negatives', () => {
|
2023-09-18 21:06:51 +00:00
|
|
|
expect(fibonacci(-25)).toBe("OOPS");
|
2023-01-21 17:53:41 +00:00
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('DOES accept strings', () => {
|
2023-09-18 21:06:51 +00:00
|
|
|
expect(fibonacci("0")).toBe(0);
|
2023-01-21 17:53:41 +00:00
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('DOES accept strings', () => {
|
2023-09-18 21:06:51 +00:00
|
|
|
expect(fibonacci("1")).toBe(1);
|
2023-01-21 17:53:41 +00:00
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('DOES accept strings', () => {
|
2023-09-18 21:06:51 +00:00
|
|
|
expect(fibonacci("2")).toBe(1);
|
|
|
|
});
|
2023-09-18 21:11:09 +00:00
|
|
|
test('DOES accept strings', () => {
|
2023-09-18 21:06:51 +00:00
|
|
|
expect(fibonacci("8")).toBe(21);
|
2023-01-21 17:53:41 +00:00
|
|
|
});
|
2022-02-20 19:07:44 +00:00
|
|
|
});
|