Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild and package status-checker #420

Merged
merged 2 commits into from
Oct 4, 2024
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
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