Skip to content

Commit

Permalink
chore: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Sep 30, 2024
1 parent a48f8a7 commit 3ece0fd
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe("User start/stop", () => {

context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toThrow("You are not assigned to this task");
await expect(userStartStop(context)).rejects.toMatchObject({ logMessage: { raw: "You are not assigned to this task" } });
});

test("User can't stop an issue without assignees", async () => {
Expand All @@ -151,7 +151,7 @@ describe("User start/stop", () => {
const context = createContext(issue, sender, "/stop") as Context<"issue_comment.created">;
context.adapters = createAdapters(getSupabase(), context as unknown as Context);

await expect(userStartStop(context)).rejects.toThrow("You are not assigned to this task");
await expect(userStartStop(context)).rejects.toMatchObject({ logMessage: { raw: "You are not assigned to this task" } });
});

test("User can't start an issue that's already assigned", async () => {
Expand All @@ -162,7 +162,9 @@ describe("User start/stop", () => {

context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toThrow("This issue is already assigned. Please choose another unassigned task.");
await expect(userStartStop(context)).rejects.toMatchObject({
logMessage: { raw: "This issue is already assigned. Please choose another unassigned task." },
});
});

test("User can't start an issue without a price label", async () => {
Expand All @@ -173,7 +175,7 @@ describe("User start/stop", () => {

context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toThrow("No price label is set to calculate the duration");
await expect(userStartStop(context)).rejects.toMatchObject({ logMessage: { raw: "No price label is set to calculate the duration" } });
});

test("User can't start an issue without a wallet address", async () => {
Expand All @@ -194,7 +196,7 @@ describe("User start/stop", () => {

context.adapters = createAdapters(getSupabase(), context as unknown as Context);

await expect(userStartStop(context)).rejects.toThrow("This issue is closed, please choose another.");
await expect(userStartStop(context)).rejects.toMatchObject({ logMessage: { raw: "This issue is closed, please choose another." } });
});

test("User can't start an issue that's a parent issue", async () => {
Expand All @@ -205,7 +207,7 @@ describe("User start/stop", () => {

context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toThrow("Skipping '/start' since the issue is a parent issue");
await expect(userStartStop(context)).rejects.toMatchObject({ logMessage: { raw: "Skipping '/start' since the issue is a parent issue" } });
});

test("should set maxLimits to 6 if the user is a member", async () => {
Expand All @@ -218,7 +220,9 @@ describe("User start/stop", () => {
const context = createContext(issue, sender) as unknown as Context;

context.adapters = createAdapters(getSupabase(), context as unknown as Context);
await expect(userStartStop(context)).rejects.toThrow("You have reached your max task limit. Please close out some tasks before assigning new ones.");
await expect(userStartStop(context)).rejects.toMatchObject({
logMessage: { raw: "You have reached your max task limit. Please close out some tasks before assigning new ones." },
});

expect(memberLimit).toEqual(6);
});
Expand All @@ -230,7 +234,9 @@ describe("User start/stop", () => {
const context = createContext(issue, sender, "/start") as Context<"issue_comment.created">;
context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toThrow("user2 you were previously unassigned from this task. You cannot be reassigned.");
await expect(userStartStop(context)).rejects.toMatchObject({
logMessage: { raw: "user2 you were previously unassigned from this task. You cannot be reassigned." },
});
});

test("Should throw if no BOT_USER_ID is set", async () => {
Expand Down

0 comments on commit 3ece0fd

Please sign in to comment.