From 950d7e430b833f3e428f1af100f6fb74bdd76a2d Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Tue, 11 Aug 2026 17:41:01 -0400 Subject: Read the About box and latest release from JSON GitHub rebuilt the repository sidebar, so the selectors parseRepoInfo used matched nothing and the About box rendered empty. Everything but the latest release is in the page's embedded payload as sidebarAbout; the latest release is only in the _sidebar JSON already fetched for languages, so it arrives with that fragment and is moved beside the release count. --- src/scraper.test.ts | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/scraper.test.ts') diff --git a/src/scraper.test.ts b/src/scraper.test.ts index 5b5e78b..24fdfc0 100644 --- a/src/scraper.test.ts +++ b/src/scraper.test.ts @@ -4,7 +4,7 @@ import { getGitHubBlob, getGitHubCommits, getGitHubIssues, - getGitHubLanguages, + getGitHubSidebar, getGitHubLatestCommit, getGitHubPulls, getGitHubRefs, @@ -35,8 +35,6 @@ describe("GitHub scraper", () => { assert.strictEqual(data.info.stars?.length, 3); assert.strictEqual(data.info.forks?.length, 3); assert.strictEqual(data.info.numReleases, 38); - assert.strictEqual(data.info.latestReleaseTag, "v5.0.0"); - assert.ok(data.info.latestReleaseDate?.startsWith("2026-03-25")); assert.ok(data.items.length > 0); assert.ok(typeof data.overviewHtml?.["README.md"] === "string"); @@ -220,8 +218,8 @@ describe("GitHub scraper", () => { assert.ok(data.commit.authors.length > 0); }); - it("should fetch languages", async () => { - const data = await getGitHubLanguages("actions", "deploy-pages"); + it("should fetch the sidebar", async () => { + const data = await getGitHubSidebar("actions", "deploy-pages"); assert.strictEqual(data.repo.owner, "actions"); assert.strictEqual(data.repo.name, "deploy-pages"); @@ -229,10 +227,13 @@ describe("GitHub scraper", () => { assert.deepStrictEqual(data.languages, [ { name: "JavaScript", percentage: 100, color: "#f1e05a" }, ]); + + assert.strictEqual(data.latestRelease?.tag, "v5.0.0"); + assert.ok(data.latestRelease?.publishedAt?.startsWith("2026-03-25")); }); - it("should fetch languages for a multi-language repository", async () => { - const data = await getGitHubLanguages("rust-lang", "rust"); + it("should fetch the sidebar for a multi-language repository", async () => { + const data = await getGitHubSidebar("rust-lang", "rust"); const rust = data.languages.find((language) => language.name === "Rust"); assert.ok(rust); -- cgit v1.3.1