external-protocol-flow-store-merge.test.mjs
49 lines 1.4 KB
Raw
sha256:baa800aedf841dbf32081aa7b2befa288ac33dfc7175ac55014c55c4d8c742f9 docs: move durable-auth freeze/evidence to local developmen… Human 11 days ago
1 import { describe, it } from 'node:test';
2 import assert from 'node:assert/strict';
3 import { mergeFlowStoreJson } from '../../hub/bridge/external-agent-blob-store.mjs';
4
5 describe('mergeFlowStoreJson', () => {
6 it('merges tasks by task_id keeping fresher updated timestamp', () => {
7 const blob = JSON.stringify({
8 vaults: {
9 default: {
10 tasks: [
11 {
12 task_id: 'task_a',
13 status: 'pending',
14 updated: '2026-06-28T00:00:00.000Z',
15 title: 'blob',
16 },
17 ],
18 },
19 },
20 });
21 const local = JSON.stringify({
22 vaults: {
23 default: {
24 tasks: [
25 {
26 task_id: 'task_a',
27 status: 'blocked',
28 updated: '2026-06-28T01:00:00.000Z',
29 title: 'local',
30 },
31 {
32 task_id: 'task_b',
33 status: 'pending',
34 updated: '2026-06-28T01:00:00.000Z',
35 title: 'new',
36 },
37 ],
38 },
39 },
40 });
41
42 const merged = JSON.parse(mergeFlowStoreJson(local, blob));
43 const tasks = merged.vaults.default.tasks;
44 assert.equal(tasks.length, 2);
45 const taskA = tasks.find((t) => t.task_id === 'task_a');
46 assert.equal(taskA.title, 'local');
47 assert.equal(tasks.find((t) => t.task_id === 'task_b').title, 'new');
48 });
49 });
File History 1 commit
sha256:baa800aedf841dbf32081aa7b2befa288ac33dfc7175ac55014c55c4d8c742f9 docs: move durable-auth freeze/evidence to local developmen… Human 11 days ago