Skip to content

Commit

Permalink
Add unit tests for canceled status
Browse files Browse the repository at this point in the history
  • Loading branch information
gabalafou committed Oct 22, 2024
1 parent 33ff29d commit b147492
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/helpers/BuildMapper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ describe("buildDatetimeStatus", () => {
expect(buildDatetimeStatus(build, 2)).toMatch(/Failed$/);
});

it("should return canceled build", () => {
const build = generateBuild("CANCELED");
expect(buildDatetimeStatus(build, 2)).toMatch(/Canceled$/);
});

it("should append canceled to an active build", () => {
const build = generateBuild("CANCELED");
expect(buildDatetimeStatus(build, build.id)).toMatch(/Active - Canceled$/);
});

it("should use the scheduled_on date if the ended_on prop is null", () => {
const datetimeStatus = buildDatetimeStatus(
{
Expand All @@ -43,4 +53,9 @@ describe("buildDatetimeStatus", () => {
);
expect(datetimeStatus).toContain("November 8th, 2022");
});

it("should add tack on additional status if current build has any status other than completed", () => {
const build = generateBuild("FAILED");
expect(buildDatetimeStatus(build, build.id)).toMatch(/Active - Failed$/);
});
});

0 comments on commit b147492

Please sign in to comment.