Skip to content

Commit 8122d5d

Browse files
Essential Randomnessessential-randomness
authored andcommitted
add tests for fetching work chapters
1 parent 280518e commit 8122d5d

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

tests/chapters.test.ts

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { getWorkWithChapters } from "src/index";
2+
3+
describe("Fetches chapters list", () => {
4+
test("Fetches chapters from work id", async () => {
5+
const workData = await getWorkWithChapters({ workId: "43703871" });
6+
7+
expect(workData.title).toBe("Let The River Run");
8+
expect(workData.authors).toMatchObject([
9+
{
10+
username: "astolat",
11+
pseud: "astolat",
12+
},
13+
]);
14+
expect(workData.workId).toBe("43703871");
15+
expect(workData.chapters).toMatchObject([
16+
{
17+
id: "109896639",
18+
index: 1,
19+
publishedAt: "2022-12-19",
20+
title: "Coming Through The Fog",
21+
url: "https://archiveofourown.org/works/43703871/chapters/109896639",
22+
workId: "43703871",
23+
},
24+
{
25+
id: "109943109",
26+
index: 2,
27+
publishedAt: "2022-12-20",
28+
title: "The Darkening Dawn",
29+
url: "https://archiveofourown.org/works/43703871/chapters/109943109",
30+
workId: "43703871",
31+
},
32+
{
33+
id: "109984306",
34+
index: 3,
35+
publishedAt: "2022-12-20",
36+
title: "Come Run With Me Now",
37+
url: "https://archiveofourown.org/works/43703871/chapters/109984306",
38+
workId: "43703871",
39+
},
40+
{
41+
id: "110032191",
42+
index: 4,
43+
publishedAt: "2022-12-21",
44+
title: "Trembling, Shaking",
45+
url: "https://archiveofourown.org/works/43703871/chapters/110032191",
46+
workId: "43703871",
47+
},
48+
{
49+
id: "110083590",
50+
index: 5,
51+
publishedAt: "2022-12-22",
52+
title: "Stand On A Star",
53+
url: "https://archiveofourown.org/works/43703871/chapters/110083590",
54+
workId: "43703871",
55+
},
56+
{
57+
id: "110133096",
58+
index: 6,
59+
publishedAt: "2022-12-23",
60+
title: "Blaze A Trail Of Desire",
61+
url: "https://archiveofourown.org/works/43703871/chapters/110133096",
62+
workId: "43703871",
63+
},
64+
{
65+
id: "110186152",
66+
index: 7,
67+
publishedAt: "2022-12-24",
68+
title: "Sirens Call Them On",
69+
url: "https://archiveofourown.org/works/43703871/chapters/110186152",
70+
workId: "43703871",
71+
},
72+
{
73+
id: "110240500",
74+
index: 8,
75+
publishedAt: "2022-12-25",
76+
title: "Running On The Water",
77+
url: "https://archiveofourown.org/works/43703871/chapters/110240500",
78+
workId: "43703871",
79+
},
80+
{
81+
id: "110242083",
82+
index: 9,
83+
publishedAt: "2022-12-25",
84+
title: "Epilogue (Silver Cities Rise)",
85+
url: "https://archiveofourown.org/works/43703871/chapters/110242083",
86+
workId: "43703871",
87+
},
88+
]);
89+
});
90+
});

0 commit comments

Comments
 (0)