From 6282587c2017e2565f0ebf6681683c879ed6aa16 Mon Sep 17 00:00:00 2001 From: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> Date: Thu, 29 Oct 2026 19:17:29 +0800 Subject: [PATCH] test(cli): preserve byte comparisons with compatible types Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> --- cli/test/unit/integrations/operation-store.test.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cli/test/unit/integrations/operation-store.test.ts b/cli/test/unit/integrations/operation-store.test.ts index 50d0c468e..a6adcd89e 100644 --- a/cli/test/unit/integrations/operation-store.test.ts +++ b/cli/test/unit/integrations/operation-store.test.ts @@ -163,16 +163,16 @@ test.each(['EPERM', 'EBUSY'])('journal replacement retries %s under the store lo const root = await mkdtemp(join(tmpdir(), 'skillhub-journal-retry-')) let armed = false; let attempts = 0; let validations = 0 const reachedRename = Promise.withResolvers() - let firstAttempt: { source: string; target: string; payload: Buffer } | undefined - let previous: Buffer | undefined + let firstAttempt: { source: string; target: string; payload: string } | undefined + let previous: string | undefined let competing: Promise[]> | undefined try { const store = await OperationStore.open(root, (from, to) => renameAtomicFile(from, to, async (source, target) => { if (armed) { - const observation = { source, target, payload: await readFile(source) } + const observation = { source: String(source), target: String(target), payload: (await readFile(source)).toString('hex') } if (!firstAttempt) firstAttempt = observation else expect(observation).toEqual(firstAttempt) - expect(await readFile(target)).toEqual(previous!) + expect((await readFile(target)).toString('hex')).toEqual(previous!) if (++attempts < 3) { reachedRename.resolve(); throw Object.assign(new Error('Sharing failure'), { code }) } } await rename(source, target) @@ -180,7 +180,7 @@ test.each(['EPERM', 'EBUSY'])('journal replacement retries %s under the store lo const key = request(store) const initial = (await store.accept(key, async () => { validations++; return accepted }))! const other = await OperationStore.open(root) - previous = await readFile(join(root, initial.operationId + '.json')) + previous = (await readFile(join(root, initial.operationId + '.json'))).toString('hex') armed = true const updating = store.update(initial.operationId, key.ownerId, 0, { ...initial.operation.status, phase: 'staging' }) await reachedRename.promise