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
8 changes: 4 additions & 4 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"@eslint/markdown": "^7.5.1",
"@types/node": "^25.5.0",
"@vitest/coverage-v8": "^4.0.18",
"@vitest/eslint-plugin": "^1.6.9",
"@vitest/eslint-plugin": "^1.6.12",
"eslint": "^10.0.3",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-package-json": "^0.91.0",
Expand Down
36 changes: 17 additions & 19 deletions tests/issue-management.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("[env variable mock]", () => {

test("getIssue fails gracefully on connection issues", async () => {
expect.assertions(1);
await expect(getIssue()).rejects.toThrowError(IssueListError);
await expect(getIssue()).rejects.toThrow(IssueListError);
});

test("getIssue fails gracefully on nonexistent repo", async () => {
Expand All @@ -65,7 +65,7 @@ describe("[env variable mock]", () => {
.query({ creator: "github-actions[bot]", labels: "wpvc" })
.reply(404);

await expect(getIssue()).rejects.toThrowError(IssueListError);
await expect(getIssue()).rejects.toThrow(IssueListError);
});

test("commentOnIssue works correctly", async () => {
Expand All @@ -85,7 +85,7 @@ describe("[env variable mock]", () => {

test("commentOnIssue fails gracefully on connection issues", async () => {
expect.assertions(1);
await expect(commentOnIssue(123, "ISSUE_BODY")).rejects.toThrowError(
await expect(commentOnIssue(123, "ISSUE_BODY")).rejects.toThrow(
IssueCommentError,
);
});
Expand All @@ -101,7 +101,7 @@ describe("[env variable mock]", () => {
})
.reply(404);

await expect(commentOnIssue(123, issueBody)).rejects.toThrowError(
await expect(commentOnIssue(123, issueBody)).rejects.toThrow(
IssueCommentError,
);
expect(scope.isDone()).toBe(true);
Expand All @@ -122,7 +122,7 @@ describe("[env variable mock]", () => {

test("closeIssue fails gracefully on connection issues", async () => {
expect.assertions(1);
await expect(closeIssue(123)).rejects.toThrowError(IssueUpdateError);
await expect(closeIssue(123)).rejects.toThrow(IssueUpdateError);
});

test("closeIssue fails gracefully on nonexistent repo", async () => {
Expand All @@ -134,7 +134,7 @@ describe("[env variable mock]", () => {
})
.reply(404);

await expect(closeIssue(123)).rejects.toThrowError(IssueUpdateError);
await expect(closeIssue(123)).rejects.toThrow(IssueUpdateError);
expect(scope.isDone()).toBe(true);
});

Expand Down Expand Up @@ -181,19 +181,19 @@ describe("[env variable mock]", () => {
test("createIssue fails gracefully on connection issues", async () => {
expect.assertions(1);

await expect(
createIssue("ISSUE_TITLE", "ISSUE_BODY", []),
).rejects.toThrowError(IssueCreationError);
await expect(createIssue("ISSUE_TITLE", "ISSUE_BODY", [])).rejects.toThrow(
IssueCreationError,
);
});

test("createIssue fails gracefully on nonexistent repo", async () => {
expect.assertions(1);

nock("https://api.github.com").post("/repos/OWNER/REPO/issues").reply(404);

await expect(
createIssue("ISSUE_TITLE", "ISSUE_BODY", []),
).rejects.toThrowError(IssueCreationError);
await expect(createIssue("ISSUE_TITLE", "ISSUE_BODY", [])).rejects.toThrow(
IssueCreationError,
);
});

test("updateIssue works correctly with an up-to-date-issue", async () => {
Expand Down Expand Up @@ -254,9 +254,7 @@ describe("[env variable mock]", () => {
.patch("/repos/OWNER/REPO/issues/123", { body, title })
.reply(200);

await expect(updateIssue(123, title, body)).rejects.toThrowError(
GetIssueError,
);
await expect(updateIssue(123, title, body)).rejects.toThrow(GetIssueError);
});

test("updateIssue fails gracefully on connection issues on updating the existing issue", async () => {
Expand All @@ -269,7 +267,7 @@ describe("[env variable mock]", () => {
.get("/repos/OWNER/REPO/issues/123")
.reply(200, { body, title: "WRONG_TITLE" });

await expect(updateIssue(123, title, body)).rejects.toThrowError(
await expect(updateIssue(123, title, body)).rejects.toThrow(
IssueUpdateError,
);
expect(scope.isDone()).toBe(true);
Expand All @@ -284,8 +282,8 @@ describe("[env variable mock]", () => {
.patch("/repos/OWNER/REPO/issues/123")
.reply(404);

await expect(
updateIssue(123, "ISSUE_TITLE", "ISSUE_BODY"),
).rejects.toThrowError(GetIssueError);
await expect(updateIssue(123, "ISSUE_TITLE", "ISSUE_BODY")).rejects.toThrow(
GetIssueError,
);
});
});
20 changes: 5 additions & 15 deletions tests/tested-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ describe("[env variable mock]", () => {
readme: ["path/to/readme.txt"],
};

await expect(testedVersion(config)).rejects.toThrowError(
InvalidReadmeError,
);
await expect(testedVersion(config)).rejects.toThrow(InvalidReadmeError);
});

test("testedVersion fails gracefully on no readme", async () => {
Expand All @@ -82,9 +80,7 @@ describe("[env variable mock]", () => {
.get(`/repos/OWNER/REPO/contents/${encodeURIComponent(readmePath)}`)
.reply(404);

await expect(testedVersion(config)).rejects.toThrowError(
InvalidReadmeError,
);
await expect(testedVersion(config)).rejects.toThrow(InvalidReadmeError);
});

test("testedVersion fails gracefully on invalid response", async () => {
Expand All @@ -101,9 +97,7 @@ describe("[env variable mock]", () => {
.get(`/repos/OWNER/REPO/contents/${encodeURIComponent(readmePath)}`)
.reply(200);

await expect(testedVersion(config)).rejects.toThrowError(
InvalidReadmeError,
);
await expect(testedVersion(config)).rejects.toThrow(InvalidReadmeError);
});

test("testedVersion fails gracefully on invalid response 2", async () => {
Expand All @@ -122,9 +116,7 @@ describe("[env variable mock]", () => {
content: "OOPS",
});

await expect(testedVersion(config)).rejects.toThrowError(
InvalidReadmeError,
);
await expect(testedVersion(config)).rejects.toThrow(InvalidReadmeError);
});

test.each([
Expand All @@ -150,9 +142,7 @@ describe("[env variable mock]", () => {
content: Buffer.from(readme).toString("base64"),
});

await expect(testedVersion(config)).rejects.toThrowError(
InvalidReadmeError,
);
await expect(testedVersion(config)).rejects.toThrow(InvalidReadmeError);
});

test("testedVersion works correctly with one invalid and one valid readme", async () => {
Expand Down
14 changes: 7 additions & 7 deletions tests/wordpress-versions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test("wordpressVersions works correctly when stable, RC, and beta versions are a

test("wordpressVersions fails gracefully on connection issues", async () => {
expect.assertions(1);
await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});

test("wordpressVersions fails gracefully on connection issues 2", async () => {
Expand All @@ -61,7 +61,7 @@ test("wordpressVersions fails gracefully on connection issues 2", async () => {
.get("/core/version-check/1.7/?channel=beta")
.reply(404);

await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});

test("wordpressVersions fails gracefully on invalid response", async () => {
Expand All @@ -71,7 +71,7 @@ test("wordpressVersions fails gracefully on invalid response", async () => {
.get("/core/version-check/1.7/?channel=beta")
.reply(200);

await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});

test("wordpressVersions fails gracefully on invalid response 2", async () => {
Expand All @@ -83,7 +83,7 @@ test("wordpressVersions fails gracefully on invalid response 2", async () => {
translations: [],
});

await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});

test("wordpressVersions fails gracefully on invalid response 3", async () => {
Expand All @@ -96,7 +96,7 @@ test("wordpressVersions fails gracefully on invalid response 3", async () => {
translations: [],
});

await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});

test("wordpressVersions fails gracefully on invalid response 4", async () => {
Expand All @@ -113,7 +113,7 @@ test("wordpressVersions fails gracefully on invalid response 4", async () => {
translations: [],
});

await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});

test("wordpressVersions fails gracefully on invalid response 5", async () => {
Expand All @@ -130,5 +130,5 @@ test("wordpressVersions fails gracefully on invalid response 5", async () => {
translations: [],
});

await expect(wordpressVersions()).rejects.toThrowError(LatestVersionError);
await expect(wordpressVersions()).rejects.toThrow(LatestVersionError);
});
20 changes: 10 additions & 10 deletions tests/wpvc-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("Mocked env variables", () => {

test("getWPVCConfig fails gracefully on connection issues", async () => {
expect.assertions(1);
await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig returns defaults on no config", async () => {
Expand Down Expand Up @@ -115,7 +115,7 @@ describe("Mocked env variables", () => {
.get("/repos/OWNER/REPO/contents/.wordpress-version-checker.json")
.reply(200);

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid response 2", async () => {
Expand All @@ -127,7 +127,7 @@ describe("Mocked env variables", () => {
content: "OOPS",
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config", async () => {
Expand All @@ -139,7 +139,7 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(false)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config 2", async () => {
Expand All @@ -155,7 +155,7 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(config)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config 3", async () => {
Expand All @@ -171,7 +171,7 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(config)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config 4", async () => {
Expand All @@ -187,7 +187,7 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(config)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config 5", async () => {
Expand All @@ -203,7 +203,7 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(config)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config 6", async () => {
Expand All @@ -219,7 +219,7 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(config)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});

test("getWPVCConfig fails gracefully on invalid config 7", async () => {
Expand All @@ -235,6 +235,6 @@ describe("Mocked env variables", () => {
content: Buffer.from(JSON.stringify(config)).toString("base64"),
});

await expect(getWPVCConfig()).rejects.toThrowError(ConfigError);
await expect(getWPVCConfig()).rejects.toThrow(ConfigError);
});
});
Loading