odin-default-js-exercises/fibonacci/fibonacci.spec.js

26 lines
585 B
JavaScript
Raw Normal View History

2017-12-15 17:01:24 +00:00
const fibonacci = require("./fibonacci");
2017-08-25 19:29:48 +00:00
2017-12-15 17:01:24 +00:00
describe("fibonacci", () => {
it("works", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci(4)).toEqual(3);
});
2017-12-15 17:01:24 +00:00
it("works", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci(6)).toEqual(8);
});
2017-12-15 17:01:24 +00:00
it("works", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci(10)).toEqual(55);
});
2017-12-15 17:01:24 +00:00
it("works", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci(15)).toEqual(610);
});
2017-12-15 17:01:24 +00:00
it("works", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci(25)).toEqual(75025);
});
2017-12-15 17:01:24 +00:00
it("doesn't accept negatives", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci(-25)).toEqual("OOPS");
});
2017-12-15 17:01:24 +00:00
it("DOES accept strings", () => {
2017-08-25 19:29:48 +00:00
expect(fibonacci("8")).toEqual(21);
});
});