Skip to content

Commit 5c5ee6f

Browse files
committed
feat(tests): add fetchDailyChallenge test
1 parent a43ac8e commit 5c5ee6f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/services/problem-services.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ describe("LeetCode Problem Services", () => {
1010
const leetCodeApi = new LeetCode(credential);
1111
const service = new LeetCodeGlobalService(leetCodeApi, credential);
1212

13+
describe("fetchDailyChallenge", () => {
14+
it("should return daily challenge data", async () => {
15+
const result = await service.fetchDailyChallenge();
16+
17+
expect(result).toBeDefined();
18+
expect(result.question).toBeDefined();
19+
expect(result.question.title).toBeDefined();
20+
expect(result.question.questionId).toBeDefined();
21+
}, 30000);
22+
});
23+
1324
describe("fetchProblemSimplified", () => {
1425
it("should return simplified problem data", async () => {
1526
const titleSlug = "two-sum";
@@ -44,6 +55,17 @@ describe("LeetCode Problem Services", () => {
4455
const leetCodeApi = new LeetCodeCN(credential);
4556
const service = new LeetCodeCNService(leetCodeApi, credential);
4657

58+
describe("fetchDailyChallenge", () => {
59+
it("should return daily challenge data", async () => {
60+
service.fetchDailyChallenge().then((result) => {
61+
expect(result).toBeDefined();
62+
expect(result.question).toBeDefined();
63+
expect(result.question.title).toBeDefined();
64+
expect(result.question.questionId).toBeDefined();
65+
});
66+
}, 30000);
67+
});
68+
4769
describe("fetchProblemSimplified", () => {
4870
it("should return simplified problem data", async () => {
4971
const titleSlug = "two-sum";

0 commit comments

Comments
 (0)