Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gxueatlassian committed Dec 12, 2023
1 parent 3622824 commit 2c663f9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/util/jira-issue-check-redis-util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,24 @@ jest.mock("config/feature-flags");

describe("Redis for jira issue status", () => {
const TIMEOUT = 10_000;
const ISSUE_KEY = "ABC-" + Math.floor(Math.random() * 10000);
let issueKey: string;
beforeEach(async () => {
when(numberFlag).calledWith(NumberFlags.SKIP_PROCESS_QUEUE_IF_ISSUE_NOT_FOUND_TIMEOUT, expect.anything(), expect.anything())
.mockResolvedValue(TIMEOUT);
issueKey = "ABC-" + Math.floor(Math.random() * 10000);
});
it("should save and successfully retried last status (exist)", async () => {
await saveIssueStatusToRedis(jiraHost, ISSUE_KEY, "exist");
const status = await getIssueStatusFromRedis(jiraHost, ISSUE_KEY);
await saveIssueStatusToRedis(jiraHost, issueKey, "exist");
const status = await getIssueStatusFromRedis(jiraHost, issueKey);
expect(status).toEqual("exist");
});
it("should save and successfully retried last status (not-exists)", async () => {
await saveIssueStatusToRedis(jiraHost, ISSUE_KEY, "not_exist");
const status = await getIssueStatusFromRedis(jiraHost, ISSUE_KEY);
await saveIssueStatusToRedis(jiraHost, issueKey, "not_exist");
const status = await getIssueStatusFromRedis(jiraHost, issueKey);
expect(status).toEqual("not_exist");
});
it("should return null on not found status", async () => {
const status = await getIssueStatusFromRedis(jiraHost, ISSUE_KEY);
const status = await getIssueStatusFromRedis(jiraHost, issueKey);
expect(status).toBeNull();
});
});

0 comments on commit 2c663f9

Please sign in to comment.