Skip to content

Commit

Permalink
test: update tests to align with new function signatures
Browse files Browse the repository at this point in the history
Updated test cases to include additional parameters and mocks for compatibility.
  • Loading branch information
gentlementlegen committed Dec 12, 2024
1 parent e73c062 commit 5271099
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/fees.test.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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(
'<details><summary><b><h3>&nbsp;<a href="https://pay.ubq.fi" target="_blank" rel="noopener">[ 100 WXDAI ]</a>&nbsp;</h3><h6>@ubiquity-os</h6></b></summary><h6>⚠️ 20% fee rate has been applied. Consider using the&nbsp;<a href="https://dao.ubq.fi/dollar" target="_blank" rel="noopener">Ubiquity Dollar</a>&nbsp;for no fees.</h6><h6>Contributions Overview</h6><table><thead><tr><th>View</th><th>Contribution</th><th>Count</th><th>Reward</th></tr></thead><tbody><tr><td>Issue</td><td>Task</td><td>1.5</td><td>50</td></tr></tbody></table><h6>Conversation Incentives</h6><table><thead><tr><th>Comment</th><th>Formatting</th><th>Relevance</th><th>Priority</th><th>Reward</th></tr></thead><tbody></tbody></table></details>\n' +
Expand Down
1 change: 1 addition & 0 deletions tests/price-label.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ afterAll(() => server.close());
jest.unstable_mockModule("../src/helpers/label-price-extractor", () => {
return {
getSortedPrices: jest.fn(() => []),
getTaskReward: jest.fn(() => 0),
};
});

Expand Down
6 changes: 5 additions & 1 deletion tests/process.issue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

Expand Down

0 comments on commit 5271099

Please sign in to comment.