From 5271099f9ed8bc6bb7be66cac3141be61bfcab4b Mon Sep 17 00:00:00 2001 From: gentlementlegen Date: Thu, 12 Dec 2024 18:19:08 +0900 Subject: [PATCH] test: update tests to align with new function signatures Updated test cases to include additional parameters and mocks for compatibility. --- tests/fees.test.ts | 3 ++- tests/price-label.test.ts | 1 + tests/process.issue.test.ts | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/fees.test.ts b/tests/fees.test.ts index 2c6b4701..63797ec7 100644 --- a/tests/fees.test.ts +++ b/tests/fees.test.ts @@ -1,4 +1,5 @@ import { beforeEach, describe, expect, it, jest } from "@jest/globals"; +import { IssueActivity } from "../src/issue-activity"; import { ContextPlugin } from "../src/types/plugin-input"; import { Result } from "../src/types/results"; import cfg from "./__mocks__/results/valid-configuration.json"; @@ -66,7 +67,7 @@ describe("GithubCommentModule Fee Tests", () => { jest.spyOn(githubCommentModule, "_generateHtml"); - const bodyContent = await githubCommentModule.getBodyContent(result); + const bodyContent = await githubCommentModule.getBodyContent({} as unknown as IssueActivity, result); expect(bodyContent).toEqual( '

 [ 100 WXDAI ] 

@ubiquity-os
⚠️ 20% fee rate has been applied. Consider using the Ubiquity Dollar for no fees.
Contributions Overview
ViewContributionCountReward
IssueTask1.550
Conversation Incentives
CommentFormattingRelevancePriorityReward
\n' + diff --git a/tests/price-label.test.ts b/tests/price-label.test.ts index 1c4bb23e..a374e3db 100644 --- a/tests/price-label.test.ts +++ b/tests/price-label.test.ts @@ -11,6 +11,7 @@ afterAll(() => server.close()); jest.unstable_mockModule("../src/helpers/label-price-extractor", () => { return { getSortedPrices: jest.fn(() => []), + getTaskReward: jest.fn(() => 0), }; }); diff --git a/tests/process.issue.test.ts b/tests/process.issue.test.ts index 6073a920..a79d0f88 100644 --- a/tests/process.issue.test.ts +++ b/tests/process.issue.test.ts @@ -298,7 +298,11 @@ describe("Modules tests", () => { }); it("Should generate GitHub comment without zero total", async () => { const githubCommentModule = new GithubCommentModule(ctx); - const postBody = await githubCommentModule.getBodyContent(githubCommentAltResults as unknown as Result); + const postBody = await githubCommentModule.getBodyContent( + // @ts-expect-error only needed to fulfill the function signature + {}, + githubCommentAltResults as unknown as Result + ); expect(postBody).not.toContain("whilefoo"); });