test: verify app startup from persisted engine snapshot

This commit is contained in:
Codex
2026-02-18 13:04:01 +00:00
parent 1236821650
commit 76001b50de

View File

@@ -249,6 +249,36 @@ test("emits persistence snapshots on mutating actions", () => {
assert.equal(typeof latest.engine, "object"); assert.equal(typeof latest.engine, "object");
}); });
test("can boot app from previously persisted state snapshot", () => {
const snapshots = [];
const app1 = createApp({
onMutation(state) {
snapshots.push(state);
},
});
call(app1, {
method: "POST",
path: "/app/actions/topup",
headers: { cookie: "xartaudio_user=restart-user" },
body: "amount=6",
});
const persistedState = snapshots[snapshots.length - 1];
const app2 = createApp({
initialState: persistedState,
});
const wallet = call(app2, {
method: "GET",
path: "/api/me/wallet",
headers: { cookie: "xartaudio_user=restart-user" },
});
assert.equal(wallet.status, 200);
assert.equal(JSON.parse(wallet.body).balance, 6);
});
test("rate limits repeated webhook calls", () => { test("rate limits repeated webhook calls", () => {
const app = createApp({ const app = createApp({
config: { config: {