diff options
| author | Joe Mou <dev@mou.fo> | 2026-09-25 01:48:21 -0400 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-09-25 02:15:02 -0400 |
| commit | 226984ad63b063c362e18260a591a3f9a035a8d3 (patch) | |
| tree | 01d6a69ee1ba5234d74c83e78b0c85e44dc07904 /src/scraper.test.ts | |
| parent | 181830285ac128ce0b5946b1c5d4e45fa51612ed (diff) | |
Show each repo nav item only if the GitHub page includes it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/scraper.test.ts')
| -rw-r--r-- | src/scraper.test.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/scraper.test.ts b/src/scraper.test.ts index a8debd7..83a82f0 100644 --- a/src/scraper.test.ts +++ b/src/scraper.test.ts @@ -45,6 +45,10 @@ describe("GitHub scraper", () => { assert.ok(data.items.length > 0); assert.ok(typeof data.overviewHtml?.["README.md"] === "string"); + + assert.ok(data.tabs?.includes("issues")); + assert.ok(data.tabs?.includes("pull-requests")); + assert.ok(!data.tabs?.includes("wiki")); }); it("should fetch tree", async () => { @@ -434,6 +438,7 @@ describe("GitHub scraper", () => { assert.strictEqual(data.repo.owner, "microsoft"); assert.strictEqual(data.repo.name, "vscode"); assert.strictEqual(data.title, "Home"); + assert.ok(data.tabs?.includes("wiki")); assert.strictEqual(data.updatedBy, "Greg Van Liew"); assert.strictEqual(data.updatedAt, "2019-11-22T03:08:32Z"); @@ -496,6 +501,14 @@ describe("GitHub scraper", () => { assert.strictEqual(home.updatedAt, "2018-02-08T18:57:56Z"); }); + it("should leave out the tabs of features a repository has disabled", async () => { + const data = await getGitHubReleases("torvalds", "linux"); + + assert.ok(data.tabs?.includes("code")); + assert.ok(!data.tabs?.includes("issues")); + assert.ok(!data.tabs?.includes("pull-requests")); + }); + it("should redirect to the repository when it has no wiki", async () => { await assert.rejects(getGitHubWiki("git", "git"), (err) => { assert(err instanceof InternalRedirectError, "error should be an InternalRedirectError"); |
