summaryrefslogtreecommitdiff
path: root/cgithub/src/scraper.test.ts
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-01-28 22:41:00 -0500
committerJoe Mou <dev@mou.fo>2026-01-28 23:03:09 -0500
commit94fcda59a064b5e8952d1bccb6b9a153c39acda1 (patch)
tree849ac2b7f33f62f774d145856eaee5267e3593ae /cgithub/src/scraper.test.ts
parent631bc70d94cd12d0432cca1a220a3642eea6976a (diff)
Commits list
Diffstat (limited to 'cgithub/src/scraper.test.ts')
-rw-r--r--cgithub/src/scraper.test.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/cgithub/src/scraper.test.ts b/cgithub/src/scraper.test.ts
index ae38c44..7cafd9c 100644
--- a/cgithub/src/scraper.test.ts
+++ b/cgithub/src/scraper.test.ts
@@ -2,6 +2,7 @@ import assert from "node:assert";
import { describe, it } from "node:test";
import {
getGitHubBlob,
+ getGitHubCommits,
getGitHubIssues,
getGitHubRepo,
getGitHubTree,
@@ -128,6 +129,36 @@ describe("GitHub scraper", () => {
assert.strictEqual(issue402.state, "OPEN");
assert.strictEqual(issue402.createdAt, "2025-07-03T19:07:08Z");
});
+
+ it("should fetch commits", async () => {
+ const data = await getGitHubCommits("actions", "deploy-pages", "main", "");
+
+ assert.strictEqual(data.repo.owner, "actions");
+ assert.strictEqual(data.repo.name, "deploy-pages");
+ assert.strictEqual(data.branch, "main");
+ assert.strictEqual(data.path, "");
+
+ assert.ok(data.commitGroups.length > 0);
+ const firstGroup = data.commitGroups[0];
+ assert.ok(firstGroup.title.length > 0);
+ assert.ok(firstGroup.commits.length > 0);
+
+ const firstCommit = firstGroup.commits[0];
+ assert.ok(firstCommit.oid.length === 40);
+ assert.ok(firstCommit.shortMessage.length > 0);
+ assert.ok(firstCommit.authors.length > 0);
+ });
+
+ it("should fetch commits with path", async () => {
+ const data = await getGitHubCommits("actions", "deploy-pages", "main", "src");
+
+ assert.strictEqual(data.repo.owner, "actions");
+ assert.strictEqual(data.repo.name, "deploy-pages");
+ assert.strictEqual(data.branch, "main");
+ assert.strictEqual(data.path, "src");
+
+ assert.ok(data.commitGroups.length > 0);
+ });
});
describe("rich file types", () => {