aboutsummaryrefslogtreecommitdiff
path: root/src/scraper.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/scraper.test.ts')
-rw-r--r--src/scraper.test.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/scraper.test.ts b/src/scraper.test.ts
index 3784190..adf70ae 100644
--- a/src/scraper.test.ts
+++ b/src/scraper.test.ts
@@ -1,6 +1,6 @@
import assert from "node:assert";
import { describe, it } from "node:test";
-import { getGitHubBlob, getGitHubRepo, getGitHubTree } from "./scraper.ts";
+import { getGitHubBlob, getGitHubRepo, getGitHubTree, GitHubHTTPError } from "./scraper.ts";
describe("GitHub scraper", () => {
describe("actions/deploy-pages repository", () => {
@@ -67,4 +67,14 @@ describe("GitHub scraper", () => {
assert.match(data.content, /^MIT License\n\n/);
});
});
+
+ describe("error handling", () => {
+ it("should throw for non-existent repository", async () => {
+ await assert.rejects(getGitHubRepo("nosuchowner", "nosuchrepo"), (err) => {
+ assert(err instanceof GitHubHTTPError, "error should be an HTTPError");
+ assert.strictEqual(err.status, 404);
+ return true;
+ });
+ });
+ });
});