Skip to content

Commit

Permalink
Rebuild and package status-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Oct 3, 2024
1 parent d52e7b5 commit c9c535c
Show file tree
Hide file tree
Showing 17 changed files with 872 additions and 867 deletions.
22 changes: 11 additions & 11 deletions actions/status-checker/__tests__/file-heading-extractor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ import { describe, expect, it } from "@jest/globals";
import { getHeadingTextFrom } from "../src/file-heading-extractor";

beforeAll(() => {
process.env["GITHUB_REPOSITORY"] = "dotnet/docs";
process.env["GITHUB_REPOSITORY"] = "dotnet/docs";
});

describe("file-heading-extractor", () => {
it("when calling getHeadingTextFrom correctly returns H1 value.", async () => {
const path = "__tests__/sample.md";
const actual = await getHeadingTextFrom(path);
expect(actual).toBe("The heading `System.Console` class");
});
it("when calling getHeadingTextFrom correctly returns H1 value.", async () => {
const path = "__tests__/sample.md";
const actual = await getHeadingTextFrom(path);
expect(actual).toBe("The heading `System.Console` class");
});

it("when calling getHeadingTextFrom correctly returns title value.", async () => {
const path = "__tests__/no-heading.md";
const actual = await getHeadingTextFrom(path);
expect(actual).toBe("Phew, that worked!");
});
it("when calling getHeadingTextFrom correctly returns title value.", async () => {
const path = "__tests__/no-heading.md";
const actual = await getHeadingTextFrom(path);
expect(actual).toBe("Phew, that worked!");
});
});
22 changes: 11 additions & 11 deletions actions/status-checker/__tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { wait } from "../src/wait";
import { describe, expect, it } from "@jest/globals";

describe("status-checker", () => {
it("throws invalid number when given 'foo' string", async () => {
const input = parseInt("foo", 10);
await expect(wait(input)).rejects.toThrow("milliseconds not a number");
});
it("throws invalid number when given 'foo' string", async () => {
const input = parseInt("foo", 10);
await expect(wait(input)).rejects.toThrow("milliseconds not a number");
});

it("call to 'wait' actually waits 500 ms", async () => {
const start = new Date();
await wait(500);
const end = new Date();
var delta = Math.abs(end.getTime() - start.getTime());
expect(delta).toBeGreaterThan(450);
});
it("call to 'wait' actually waits 500 ms", async () => {
const start = new Date();
await wait(500);
const end = new Date();
var delta = Math.abs(end.getTime() - start.getTime());
expect(delta).toBeGreaterThan(450);
});
});
Loading

0 comments on commit c9c535c

Please sign in to comment.