diff --git a/10_fibonacci/fibonacci.js b/10_fibonacci/fibonacci.js index 38f2021..91e3c1a 100644 --- a/10_fibonacci/fibonacci.js +++ b/10_fibonacci/fibonacci.js @@ -1,4 +1,10 @@ const fibonacci = function(number) { + if (number == 0) { + return 0; + } + if (number < 0) { + return "OOPS"; + } let a = 1, b = 1; let sum = a; for (let i = 0; diff --git a/10_fibonacci/fibonacci.spec.js b/10_fibonacci/fibonacci.spec.js index 6601caf..ef1f3c8 100644 --- a/10_fibonacci/fibonacci.spec.js +++ b/10_fibonacci/fibonacci.spec.js @@ -22,10 +22,10 @@ describe('fibonacci', () => { test('2nd fibonacci number is 1', () => { expect(fibonacci(2)).toBe(1); }); - test.skip('0th fibonacci number is 0', () => { + test('0th fibonacci number is 0', () => { expect(fibonacci(0)).toBe(0); }); - test.skip('doesn\'t accept negatives', () => { + test('doesn\'t accept negatives', () => { expect(fibonacci(-25)).toBe("OOPS"); }); test.skip('DOES accept strings', () => {