From 226984ad63b063c362e18260a591a3f9a035a8d3 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Fri, 25 Sep 2026 01:48:21 -0400 Subject: Show each repo nav item only if the GitHub page includes it Co-Authored-By: Claude Opus 5.5 --- src/scraper.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/scraper.test.ts') 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"); -- cgit v1.3.1