feat: add comprehensive end-to-end test suite

This commit is contained in:
Loic Coenen
2026-06-06 17:46:52 +00:00
committed by Loic Coenen (aider)
parent af7588b832
commit 18eb27e9c8
20 changed files with 1261 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import { setupTest, startEngine, startClientInTmux, openCmdFifo, writeFifoCommand, wait, readStatusNonBlock, teardownTest } from './test_utils';
export async function testToggleRecordStop(): Promise<void> {
console.log("\nTest: TOGGLE RECORD / STOP");
setupTest();
const engine = await startEngine();
await startClientInTmux();
openCmdFifo();
await wait(500);
// Send 'record 0' via FIFO to start recording
writeFifoCommand("record 0");
await wait(1500);
// Read status nonblocking and look for RECORD
const stAfterRecord = readStatusNonBlock();
if (stAfterRecord.includes("RECORD")) {
console.log(" PASS: Status shows RECORD");
} else {
// Wait a bit more and retry once
await wait(500);
const st2 = readStatusNonBlock();
if (st2.includes("RECORD")) {
console.log(" PASS: Status shows RECORD (after delay)");
} else {
console.log(" STATUS data: " + st2);
console.log(" WARN: Did not see RECORD in status");
}
}
// Stop
writeFifoCommand("stop");
await wait(1500);
const stAfterStop = readStatusNonBlock();
if (stAfterStop.includes("IDLE")) {
console.log(" PASS: Status shows IDLE after stop");
} else {
await wait(500);
const st3 = readStatusNonBlock();
if (st3.includes("IDLE")) {
console.log(" PASS: Status shows IDLE after stop (after delay)");
} else {
console.log(" WARN: Did not see IDLE in status");
console.log(" STATUS data: " + st3);
}
}
engine.kill();
teardownTest();
}