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