-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathverse.test.ts
39 lines (31 loc) · 1.14 KB
/
verse.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { getVerse } from "../src/api/v1/core/functions/verse";
import { expect, it, describe } from "vitest";
describe("getVerse", () => {
it("John 3:16", async () => {
const verse = await getVerse("John", "3", "16", "NIV");
expect(verse?.citation).toBe("John 3:16");
expect(verse?.passage).toBe(
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life."
);
});
it("Genesis 1:1", async () => {
const verse = await getVerse("GEN", "1", "1", "KJV");
expect(verse?.citation).toBe("Genesis 1:1");
expect(verse?.passage).toBe(
"In the beginning God created the heaven and the earth."
);
});
it("Invalid verse", async () => {
const verse = await getVerse("JHN", "3", "54", "NIV");
expect(verse?.code).toBe(400);
expect(verse?.message).toBe("Verse not found");
});
it("Invalid book", async () => {
const book = "Coffee";
const verse = await getVerse(book, "5", "11", "NIV");
expect(verse?.code).toBe(400);
expect(verse?.message).toBe(
`Could not find book '${book}' by name or alias.`
);
});
});