summaryrefslogtreecommitdiff
path: root/graphs/js/jestBasic/fibo.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'graphs/js/jestBasic/fibo.test.js')
-rw-r--r--graphs/js/jestBasic/fibo.test.js37
1 files changed, 37 insertions, 0 deletions
diff --git a/graphs/js/jestBasic/fibo.test.js b/graphs/js/jestBasic/fibo.test.js
new file mode 100644
index 0000000..6a97365
--- /dev/null
+++ b/graphs/js/jestBasic/fibo.test.js
@@ -0,0 +1,37 @@
+const { fibo } = require("./fibo");
+
+describe("basic value", () => {
+ test("fibo of 0", () => {
+ expect(fibo(0)).toBe(0);
+ });
+ test("fibo of 1", () => {
+ expect(fibo(1)).toBe(1);
+ });
+ test("fibo of 2", () => {
+ expect(fibo(2)).toBe(1);
+ });
+ test("fibo of 4", () => {
+ expect(fibo(4)).toBe(3);
+ });
+ test("fibo of 19", () => {
+ expect(fibo(19)).toBe(4181);
+ });
+});
+
+describe("errors", () => {
+ test("fibo of -1", () => {
+ expect(fibo(-1)).toBe(-1);
+ });
+ test("fibo of null", () => {
+ expect(fibo(null)).toBe(-1);
+ });
+ test("fibo of undefined", () => {
+ expect(fibo(undefined)).toBe(-1);
+ });
+ test("fibo of a string", () => {
+ expect(fibo("uwu adrien")).toBe(-1);
+ });
+ test("fibo of NaN", () => {
+ expect(fibo(NaN)).toBe(-1);
+ });
+});