Skip to content

Commit 0d9be9d

Browse files
authored
test: keep fixture proof at consumer boundaries (#133824)
1 parent 75fb940 commit 0d9be9d

5 files changed

Lines changed: 5 additions & 44 deletions

File tree

‎test/helpers/openclaw-test-instance.test.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -835,12 +835,6 @@ describe("openclaw test instance", () => {
835835
expect(logs).not.toContain("old stderr");
836836
});
837837

838-
it("treats signaled gateway children as exited", () => {
839-
expect(testing.hasChildExited({ exitCode: null, signalCode: "SIGTERM" })).toBe(true);
840-
expect(testing.hasChildExited({ exitCode: 0, signalCode: null })).toBe(true);
841-
expect(testing.hasChildExited({ exitCode: null, signalCode: null })).toBe(false);
842-
});
843-
844838
it("fails startup waits immediately after signaled gateway exits", async () => {
845839
await expect(
846840
testing.waitForGatewayReady(

‎test/helpers/openclaw-test-instance.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,6 @@ export const testing = {
726726
appendLogChunk,
727727
createBoundedStringLog,
728728
formatLogs,
729-
hasChildExited,
730729
isGatewayMigrationConvergenceRefusal,
731730
signalOpenClawTestProcess,
732731
stopGatewayProcess,

‎test/helpers/provider-http.test.ts‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
import { describe, expect, it, vi } from "vitest";
2-
import {
3-
oversizedJsonResponse,
4-
requireFirstPostJsonRecordRequest,
5-
streamedJsonResponse,
6-
} from "./provider-http.js";
1+
import { describe, expect, it } from "vitest";
2+
import { oversizedJsonResponse } from "./provider-http.js";
73

84
describe("provider HTTP fixtures", () => {
9-
it("builds streamed JSON responses", async () => {
10-
await expect(streamedJsonResponse({ ok: true }).json()).resolves.toEqual({ ok: true });
11-
});
12-
135
it("tracks bounded oversized response reads and cancellation", async () => {
146
const fixture = oversizedJsonResponse({ chunkCount: 2, chunkSize: 4 });
157
const reader = fixture.response.body?.getReader();
@@ -19,13 +11,4 @@ describe("provider HTTP fixtures", () => {
1911
expect(fixture.getReadCount()).toBe(1);
2012
expect(fixture.wasCanceled()).toBe(true);
2113
});
22-
23-
it("requires the first request to be a record", () => {
24-
const mock = vi.fn();
25-
mock({ url: "https://example.test" });
26-
27-
expect(requireFirstPostJsonRecordRequest(mock, "request")).toEqual({
28-
url: "https://example.test",
29-
});
30-
});
3114
});

‎test/scripts/check-file-utils.test.ts‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ vi.mock("node:child_process", async (importOriginal) => {
2020

2121
const { createTempDir } = createScriptTestHarness();
2222

23-
describe("scripts/check-file-utils isCodeFile", () => {
24-
it("accepts source files and skips declarations", () => {
25-
expect(isCodeFile("example.ts")).toBe(true);
26-
expect(isCodeFile("example.mjs")).toBe(true);
27-
expect(isCodeFile("example.d.ts")).toBe(false);
28-
});
29-
});
30-
3123
describe("scripts/check-file-utils collectFilesSync", () => {
3224
it("collects matching files while skipping common generated dirs", () => {
3325
const rootDir = createTempDir("openclaw-check-file-utils-");
@@ -78,14 +70,14 @@ describe("scripts/check-file-utils listRepoFilesSync", () => {
7870
execFileSyncMock.mockReset();
7971
});
8072

81-
it("bounds git ls-files with a timeout and kill signal", () => {
82-
execFileSyncMock.mockReturnValue("src/keep.ts\nsrc/skip.d.ts\n");
73+
it("filters tracked source files and bounds the git lookup", () => {
74+
execFileSyncMock.mockReturnValue("src/keep.ts\nsrc/keep.mjs\nsrc/skip.d.ts\n");
8375

8476
expect(
8577
listRepoFilesSync("/fake/repo", {
8678
includeFile: (filePath) => isCodeFile(filePath),
8779
}),
88-
).toEqual(["src/keep.ts"]);
80+
).toEqual(["src/keep.mjs", "src/keep.ts"]);
8981
expect(execFileSyncMock).toHaveBeenCalledWith(
9082
"git",
9183
expect.arrayContaining(["-C", "/fake/repo", "ls-files", "--"]),

‎test/scripts/test-device-pair-telegram.test.ts‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
11
// Test Device Pair Telegram tests cover the dev Telegram pairing smoke helper.
2-
import { pathToFileURL } from "node:url";
32
import { describe, expect, it, vi } from "vitest";
43
import {
54
parseDevicePairTelegramArgs,
65
runDevicePairTelegram,
76
} from "../../scripts/dev/test-device-pair-telegram.ts";
87

9-
const scriptUrl = pathToFileURL("scripts/dev/test-device-pair-telegram.ts").href;
10-
118
describe("scripts/dev/test-device-pair-telegram.ts", () => {
12-
it("loads without resolving the Telegram runtime sidecar", async () => {
13-
await expect(import(`${scriptUrl}?case=load-${Date.now()}`)).resolves.toBeDefined();
14-
});
15-
169
it("parses help without requiring Telegram config", () => {
1710
expect(parseDevicePairTelegramArgs(["--help"])).toEqual({
1811
accountId: undefined,

0 commit comments

Comments
 (0)