test: tighten stability bundle assertions

This commit is contained in:
Shakker
2026-05-11 05:58:21 +01:00
parent aa6e640304
commit 5cbcf2a549

View File

@@ -107,25 +107,15 @@ describe("diagnostic stability bundles", () => {
const bundle = readBundle(file);
const raw = fs.readFileSync(file, "utf8");
expect(bundle).toMatchObject({
version: 1,
generatedAt: "2026-04-22T12:00:00.000Z",
reason: "gateway.restart_startup_failed",
error: {
name: "Error",
code: "ERR_TEST",
},
host: {
hostname: "<redacted-hostname>",
},
snapshot: {
count: 2,
},
});
expect(bundle.snapshot.events[0]).toMatchObject({
type: "webhook.error",
channel: "telegram",
});
expect(bundle.version).toBe(1);
expect(bundle.generatedAt).toBe("2026-04-22T12:00:00.000Z");
expect(bundle.reason).toBe("gateway.restart_startup_failed");
expect(bundle.error?.name).toBe("Error");
expect(bundle.error?.code).toBe("ERR_TEST");
expect(bundle.host.hostname).toBe("<redacted-hostname>");
expect(bundle.snapshot.count).toBe(2);
expect(bundle.snapshot.events[0]?.type).toBe("webhook.error");
expect(bundle.snapshot.events[0]?.channel).toBe("telegram");
expect(bundle.snapshot.events[0]).not.toHaveProperty("chatId");
expect(bundle.snapshot.events[0]).not.toHaveProperty("error");
expect(bundle.error?.message).toContain("google/web-search-contract-api.js");
@@ -161,18 +151,14 @@ describe("diagnostic stability bundles", () => {
}
const bundle = readBundle(result.path);
const raw = fs.readFileSync(result.path, "utf8");
expect(bundle).toMatchObject({
reason: "gateway.restart_startup_failed",
error: {
name: "Error",
code: "ERR_CONFIG_PARSE",
message: "raw startup config payload",
},
snapshot: {
count: 0,
events: [],
},
expect(bundle.reason).toBe("gateway.restart_startup_failed");
expect(bundle.error).toEqual({
name: "Error",
code: "ERR_CONFIG_PARSE",
message: "raw startup config payload",
});
expect(bundle.snapshot.count).toBe(0);
expect(bundle.snapshot.events).toEqual([]);
expect(raw).not.toContain("stack");
});