perf(test): compact remaining heartbeat fixture writes

This commit is contained in:
Peter Steinberger
2026-02-22 09:30:43 +00:00
parent c8d473c8e8
commit 9882bfe186

View File

@@ -634,19 +634,15 @@ describe("runHeartbeatOnce", () => {
await fs.writeFile(sessionFile, "", "utf-8"); await fs.writeFile(sessionFile, "", "utf-8");
await fs.writeFile( await fs.writeFile(
storePath, storePath,
JSON.stringify( JSON.stringify({
{ [sessionKey]: {
[sessionKey]: { sessionId,
sessionId, sessionFile,
sessionFile, updatedAt: Date.now(),
updatedAt: Date.now(), lastChannel: "whatsapp",
lastChannel: "whatsapp", lastTo: "+1555",
lastTo: "+1555",
},
}, },
null, }),
2,
),
); );
replySpy.mockResolvedValue([{ text: "Final alert" }]); replySpy.mockResolvedValue([{ text: "Final alert" }]);
@@ -942,19 +938,15 @@ describe("runHeartbeatOnce", () => {
await fs.mkdir(path.dirname(storePath), { recursive: true }); await fs.mkdir(path.dirname(storePath), { recursive: true });
await fs.writeFile( await fs.writeFile(
storePath, storePath,
JSON.stringify( JSON.stringify({
{ [sessionKey]: {
[sessionKey]: { sessionId: "sid",
sessionId: "sid", updatedAt: Date.now(),
updatedAt: Date.now(), lastChannel: "whatsapp",
lastChannel: "whatsapp", lastProvider: "whatsapp",
lastProvider: "whatsapp", lastTo: "+1555",
lastTo: "+1555",
},
}, },
null, }),
2,
),
); );
replySpy.mockResolvedValue({ text: "Hello from heartbeat" }); replySpy.mockResolvedValue({ text: "Hello from heartbeat" });
@@ -1022,18 +1014,14 @@ describe("runHeartbeatOnce", () => {
const sessionKey = resolveMainSessionKey(cfg); const sessionKey = resolveMainSessionKey(cfg);
await fs.writeFile( await fs.writeFile(
storePath, storePath,
JSON.stringify( JSON.stringify({
{ [sessionKey]: {
[sessionKey]: { sessionId: "sid",
sessionId: "sid", updatedAt: Date.now(),
updatedAt: Date.now(), lastChannel: "whatsapp",
lastChannel: "whatsapp", lastTo: "+1555",
lastTo: "+1555",
},
}, },
null, }),
2,
),
); );
if (params.queueCronEvent) { if (params.queueCronEvent) {
enqueueSystemEvent("Cron: QMD maintenance completed", { enqueueSystemEvent("Cron: QMD maintenance completed", {