Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review: single-quote strings in fileWriteQueue.test.js

[._.]/ Adam Eivy5c3213ea30d0
diff --git a/server/lib/fileWriteQueue.test.js b/server/lib/fileWriteQueue.test.js
index 4853039a78..5b446a354e 100644
--- a/server/lib/fileWriteQueue.test.js
+++ b/server/lib/fileWriteQueue.test.js
@@ -1,22 +1,22 @@
-import { describe, it, expect } from "vitest";
-import { createFileWriteQueue } from "./fileWriteQueue.js";
+import { describe, it, expect } from 'vitest';
+import { createFileWriteQueue } from './fileWriteQueue.js';
// Defer one event-loop tick (setImmediate is a check-phase macrotask, not a
// microtask) so we can interleave with another awaiter.
const tick = () => new Promise((r) => setImmediate(r));
-describe("createFileWriteQueue", () => {
- it("runs queued fns in submission order even when their work yields", async () => {
+describe('createFileWriteQueue', () => {
+ it('runs queued fns in submission order even when their work yields', async () => {
const queue = createFileWriteQueue();
const order = [];
- const a = queue(async () => { await tick(); order.push("a"); });
- const b = queue(async () => { order.push("b"); });
- const c = queue(async () => { await tick(); order.push("c"); });
+ const a = queue(async () => { await tick(); order.push('a'); });
+ const b = queue(async () => { order.push('b'); });
+ const c = queue(async () => { await tick(); order.push('c'); });
await Promise.all([a, b, c]);
- expect(order).toEqual(["a", "b", "c"]);
+ expect(order).toEqual(['a', 'b', 'c']);
});
- it("an earlier rejection does not poison later waiters AND order is preserved", async () => {
+ it('an earlier rejection does not poison later waiters AND order is preserved', async () => {
const queue = createFileWriteQueue();
const order = [];
// Without `tail.then(fn, fn)` (running fn on the rejection path), a
@@ -24,14 +24,14 @@ describe("createFileWriteQueue", () => {
// would fail. The `tick()` ensures the order assertion fails for a
// pass-through queue (where parallel fns would land in submission order
// but the rejecting one would still log AFTER the fast resolver).
- const bad = queue(async () => { await tick(); order.push("bad"); throw new Error("nope"); });
- const good = queue(async () => { order.push("good"); return "ok"; });
- await expect(bad).rejects.toThrow("nope");
- await expect(good).resolves.toBe("ok");
- expect(order).toEqual(["bad", "good"]);
+ const bad = queue(async () => { await tick(); order.push('bad'); throw new Error('nope'); });
+ const good = queue(async () => { order.push('good'); return 'ok'; });
+ await expect(bad).rejects.toThrow('nope');
+ await expect(good).resolves.toBe('ok');
+ expect(order).toEqual(['bad', 'good']);
});
- it("each call sees the resolved value of its own fn", async () => {
+ it('each call sees the resolved value of its own fn', async () => {
const queue = createFileWriteQueue();
const r1 = await queue(() => Promise.resolve(1));
const r2 = await queue(() => Promise.resolve(2));
@@ -39,14 +39,14 @@ describe("createFileWriteQueue", () => {
expect(r2).toBe(2);
});
- it("separate queues are independent", async () => {
+ it('separate queues are independent', async () => {
const qA = createFileWriteQueue();
const qB = createFileWriteQueue();
const order = [];
// qA's work yields; qB's work should not wait for it.
- const aSlow = qA(async () => { await tick(); order.push("a-slow"); });
- const bFast = qB(async () => { order.push("b-fast"); });
+ const aSlow = qA(async () => { await tick(); order.push('a-slow'); });
+ const bFast = qB(async () => { order.push('b-fast'); });
await Promise.all([aSlow, bFast]);
- expect(order).toEqual(["b-fast", "a-slow"]);
+ expect(order).toEqual(['b-fast', 'a-slow']);
});
});