Skip to content

Commit ffeda89

Browse files
committed
test: increase timeout for network-dependent tests to 15s
1 parent e37768a commit ffeda89

2 files changed

Lines changed: 28 additions & 20 deletions

File tree

src/server/compare-refs.test.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,17 @@ describe("fetchCommitHistory", () => {
214214
});
215215

216216
describe("countBehind", () => {
217-
test("returns behindBy >= 0 when pinned SHA is HEAD (allows for push during test)", async () => {
218-
const ref = await resolveRef(TEST_OWNER, TEST_REPO, "main");
219-
if (!ref) return; // no auth
220-
const { behindBy } = await countBehind(TEST_OWNER, TEST_REPO, "main", ref.oid, 10);
221-
// HEAD could have advanced by 1 between resolveRef calls — allow small drift
222-
expect(behindBy).toBeGreaterThanOrEqual(0);
223-
});
217+
test(
218+
"returns behindBy >= 0 when pinned SHA is HEAD (allows for push during test)",
219+
async () => {
220+
const ref = await resolveRef(TEST_OWNER, TEST_REPO, "main");
221+
if (!ref) return; // no auth
222+
const { behindBy } = await countBehind(TEST_OWNER, TEST_REPO, "main", ref.oid, 10);
223+
// HEAD could have advanced by 1 between resolveRef calls — allow small drift
224+
expect(behindBy).toBeGreaterThanOrEqual(0);
225+
},
226+
{ timeout: 15000 },
227+
);
224228

225229
test("returns behindBy > 0 when pinned to a known-old SHA", async () => {
226230
// aee827e22f75... is HEAD~5 — should be at least 5 commits behind main

src/server/module-pin-hint-tool.test.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,23 @@ describe("module_pin_hint tool", () => {
139139
expect(parsed.goPseudoVersion).toMatch(/^v0\.0\.0-\d{14}-[0-9a-f]{12}$/);
140140
});
141141

142-
test("returns NOT_FOUND for a nonexistent ref", async () => {
143-
const text = await run({
144-
owner: "Rethunk-AI",
145-
repo: "rethunk-github-mcp",
146-
ref: "refs/heads/branch-that-does-not-exist-xyzzy",
147-
language: "go",
148-
format: "json",
149-
});
150-
const parsed = JSON.parse(text) as { error?: { code: string } };
151-
if (!parsed.error) return; // unexpected — skip
152-
if (parsed.error.code === "AUTH_MISSING") return;
153-
expect(parsed.error.code).toBe("NOT_FOUND");
154-
});
142+
test(
143+
"returns NOT_FOUND for a nonexistent ref",
144+
async () => {
145+
const text = await run({
146+
owner: "Rethunk-AI",
147+
repo: "rethunk-github-mcp",
148+
ref: "refs/heads/branch-that-does-not-exist-xyzzy",
149+
language: "go",
150+
format: "json",
151+
});
152+
const parsed = JSON.parse(text) as { error?: { code: string } };
153+
if (!parsed.error) return; // unexpected — skip
154+
if (parsed.error.code === "AUTH_MISSING") return;
155+
expect(parsed.error.code).toBe("NOT_FOUND");
156+
},
157+
{ timeout: 15000 },
158+
);
155159

156160
test("markdown format: returns formatted pseudo-version block", async () => {
157161
const text = await run({

0 commit comments

Comments
 (0)