hub-open-note-seq.test.mjs
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
11 hours ago
| 1 | /** |
| 2 | * Contract: openNote uses a monotonic sequence so concurrent fetches cannot duplicate detail-actions buttons. |
| 3 | */ |
| 4 | import { describe, it } from 'node:test'; |
| 5 | import assert from 'node:assert'; |
| 6 | import fs from 'fs'; |
| 7 | import path from 'path'; |
| 8 | import { fileURLToPath } from 'url'; |
| 9 | |
| 10 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 11 | const hubJs = path.join(__dirname, '..', 'web', 'hub', 'hub.js'); |
| 12 | |
| 13 | describe('hub openNote stale-response guard', () => { |
| 14 | it('hub.js increments hubOpenNoteSeq and ignores stale fetch completions', () => { |
| 15 | const src = fs.readFileSync(hubJs, 'utf8'); |
| 16 | assert.match(src, /\blet hubOpenNoteSeq\b/); |
| 17 | assert.match(src, /const seq = \+\+hubOpenNoteSeq/); |
| 18 | assert.ok(src.includes('if (seq !== hubOpenNoteSeq) return;')); |
| 19 | assert.ok( |
| 20 | src.includes('attachNoteDetailReadActions(actionsEl)') && |
| 21 | /actionsEl\.innerHTML = '';\s*\n\s*attachNoteDetailReadActions\(actionsEl\)/.test(src), |
| 22 | ); |
| 23 | }); |
| 24 | }); |
File History
1 commit
sha256:8915fe406161f95c1681f9469375e7bae5b28c884f00bedbdef65e4b0cd0738d
docs(flow): commit FLOW-V0-SPEC.md hygiene for 7A-INT merge
Human
11 hours ago