external-protocol-flow-store-merge.test.mjs
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠ breaking
10 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:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠
10 days ago