summaryrefslogtreecommitdiff
path: root/cgithub/src/scraper.test.ts
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-03-12 15:46:12 -0400
committerJoe Mou <dev@mou.fo>2026-03-13 22:53:35 -0400
commit148272c64a97259ac874c4d8af1a93f197299012 (patch)
tree372c0688a387fcbd6eea14d9711a398fc6b19369 /cgithub/src/scraper.test.ts
parent0d95c588319e6f25f4b24612e730f662e209b5dc (diff)
Fix GitHub scraping for new JSON structure, update TypeScript interfaces
GitHub restructured their embedded JSON: tree/blob data is now split across codeViewRepoRoute, codeViewTreeRoute, codeViewBlobLayoutRoute, codeViewBlobLayoutRoute.StyledBlob, codeViewBlobRoute, and the shared codeViewLayoutRoute (repo, refInfo, path). Replace RawPayload and OverviewFile with typed interfaces for each route, add AppPayload as the top-level union, and simplify parsePayload to always extract react-app.embeddedData.
Diffstat (limited to 'cgithub/src/scraper.test.ts')
-rw-r--r--cgithub/src/scraper.test.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/cgithub/src/scraper.test.ts b/cgithub/src/scraper.test.ts
index 125e6a6..ad3ed46 100644
--- a/cgithub/src/scraper.test.ts
+++ b/cgithub/src/scraper.test.ts
@@ -95,8 +95,11 @@ describe("GitHub scraper", () => {
assert.strictEqual(data.language, "Markdown");
assert.strictEqual(data.image, false);
- assert.strictEqual(data.textLines, null);
- assert.strictEqual(data.htmlLines, null);
+ assert.strictEqual(data.textLines?.[0], "# deploy-pages 🚀");
+ assert.strictEqual(
+ data.htmlLines?.[0],
+ '<span class="pl-mh"># deploy-pages 🚀</span>deploy-pages 🚀<span class="pl-en">deploy-pages 🚀</span>',
+ );
const firstLine =
/^<article class="markdown-body entry-content container-lg" itemprop="text"><div class="markdown-heading" dir="auto"><h1 tabindex="-1" class="heading-element" dir="auto">deploy-pages 🚀<\/h1>/;
assert.match(data.htmlContent ?? "", firstLine);