Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion __tests__/checks/checks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ describe("Checks", () => {
check_suite: { id: 105 },
app: { id: 1005, slug: "another-app", name: "Another App" },
},
{
id: 6,
name: "test-check-6",
status: checkStatus.PENDING,
conclusion: null,
started_at: "2022-01-01T00:00:00Z",
completed_at: null,
check_suite: { id: 106 },
app: { id: 1006, slug: "github-actions", name: "GitHub Actions" },
},
];

// Mock own check
Expand Down Expand Up @@ -369,7 +379,7 @@ describe("Checks", () => {
await checks.fetchAllChecks();
await checks.filterChecks();

expect(checks["filteredChecks"]).toHaveLength(4);
expect(checks["filteredChecks"]).toHaveLength(5);
expect(
checks["filteredChecks"].some((check) => check.name === "test-check-1")
).toBeFalsy();
Expand Down Expand Up @@ -441,6 +451,15 @@ describe("Checks", () => {
expect(result).toEqual({ in_progress: true, passed: false });
});

it("should detect pending checks as in_progress", () => {
const checks = new Checks(defaultProps);
const pendingChecks = [mockChecks[5]]; // PENDING check

const result = checks.evaluateChecksStatus(pendingChecks);

expect(result).toEqual({ in_progress: true, passed: false });
});

it("should handle treatSkippedAsPassed option", () => {
// When treatSkippedAsPassed is true
const checksWithSkippedAsPassed = new Checks({
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/checks/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export default class Checks {
checkStatus.IN_PROGRESS,
checkStatus.QUEUED,
checkStatus.WAITING,
checkStatus.PENDING,
];
let anyInProgressQueuedWaiting = checks.filter((check) =>
inProgressQueuedWaiting.includes(check.status)
Expand Down
1 change: 1 addition & 0 deletions src/checks/checksConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const checkStatus = {
IN_PROGRESS: "in_progress",
COMPLETED: "completed",
WAITING: "waiting",
PENDING: "pending",
};

export const GitHubActionsBotSlug = "github-actions";
Loading