This commit is contained in:
Andras Schmelczer 2026-09-27 13:58:54 +01:00
commit e151208e15

View file

@ -84,7 +84,7 @@ for (const phase of ["before", "visible", "durable"] as const) {
};
await assert.rejects(session.rename("a", "b"), /crash/);
assert(fired);
disk.boundary = () => { };
disk.boundary = () => {};
const moved =
phase === "durable" || (phase === "visible" && !powerLoss);
assert.deepEqual([...disk.userFiles().keys()], [moved ? "b" : "a"]);
@ -168,10 +168,13 @@ test("unconsumed and before-send faults cannot silently pass", async () => {
);
assert(!called);
assert.throws(() => net.assertConsumed(), /never retried/);
await net.wrap(async () => new Response())("http://test/file-manifest", {
method: "PUT",
body: '{"requestId":"r"}'
});
await net.wrap(async () => Response.json({ type: "Accepted" }))(
"http://test/file-manifest",
{
method: "PUT",
body: '{"requestId":"r"}'
}
);
net.assertConsumed();
});
@ -231,7 +234,7 @@ test("seeded actions are repeatable, including seed zero", () => {
test("runner cleanup errors fail an otherwise successful test", async () => {
const server = {
isRunning: () => true,
resume: () => { }
resume: () => {}
} as unknown as ServerControl;
const runner = new TestRunner(
server,
@ -241,13 +244,16 @@ test("runner cleanup errors fail an otherwise successful test", async () => {
);
let cleaned = 0;
Object.assign(runner, {
initializeAgents: async () => { },
initializeAgents: async () => {},
agents: [
{
clientId: 0,
database: () => ({ evidence: "before cleanup" }),
disk: { image: () => ({ bytes: [0, 255] }) },
network: { requests: [{ body: { requestId: "original" } }] },
network: {
requests: [{ body: { requestId: "original" } }],
schedule: []
},
cleanup: async () => {
cleaned++;
throw new Error("late background error");
@ -267,7 +273,8 @@ test("runner cleanup errors fail an otherwise successful test", async () => {
client: 0,
database: { evidence: "before cleanup" },
disk: { bytes: [0, 255] },
requests: [{ body: { requestId: "original" } }]
requests: [{ body: { requestId: "original" } }],
schedule: []
}
]);
});
@ -282,7 +289,7 @@ test("disposed harness rejects late websocket reconnects", async () => {
test("runner preserves primary failure and cleanup diagnostics", async () => {
const server = {
isRunning: () => true,
resume: () => { }
resume: () => {}
} as unknown as ServerControl;
const runner = new TestRunner(
server,
@ -291,7 +298,7 @@ test("runner preserves primary failure and cleanup diagnostics", async () => {
"http://unused"
);
Object.assign(runner, {
initializeAgents: async () => { },
initializeAgents: async () => {},
executeStep: async () => {
throw new Error("primary assertion failed");
},
@ -300,7 +307,7 @@ test("runner preserves primary failure and cleanup diagnostics", async () => {
clientId: 0,
database: () => ({}),
disk: { image: () => ({}) },
network: { requests: [] },
network: { requests: [], schedule: [] },
cleanup: async () => {
throw new Error("cleanup failed too");
}