diff options
| author | Joe Mou <dev@mou.fo> | 2026-01-27 11:23:11 -0500 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-01-27 12:51:04 -0500 |
| commit | 70534dacebc69e05d2674a08b4b75b352b8a8913 (patch) | |
| tree | 3587cdc273adc2c65c870d18e08ae915addb34a0 /src/scraper.test.ts | |
| parent | 737770b900a6a063d83e384faf09dfa4f2a15ebd (diff) | |
Propagate GitHub HTTP errors
Render `error.eta` on HTTP error from GitHub.
Implemented with Gemini.
Diffstat (limited to 'src/scraper.test.ts')
| -rw-r--r-- | src/scraper.test.ts | 12 |
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; + }); + }); + }); }); |
