Skip to content

Commit 2c3dd06

Browse files
committed
Test(store): the #852 dirty-buffer test settles its own save (#852)
The forced test run before the 2.56.0 cut failed once, in a #585 test that saw a write it never made: `unsaved typing` landing in `Work/Documentation/Vault CLI Cheatsheet.md`. That text belongs to the #852 test that checks a watcher change refused over a dirty buffer does not move the note's disk revision. Typing arms the store's 350 ms debounced save, the test ended without settling it, and under turbo's parallel load the timer fired while a later test was collecting `writeCalls`, which the file shares across tests. Alone, the file was green every time, which is why the leak went unnoticed in the cycle. The test now ends by calling `persistNote` itself, which clears the pending timer and writes the typing to the fake disk, and asserts that this write does not move the revision either: the user's own save is not a disk change. The store is untouched.
1 parent 703c688 commit 2c3dd06

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎packages/app-core/src/store-note-integrity.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ describe('#852: a note body taken from disk moves its disk revision', () => {
258258
await flush()
259259
expect(useStore.getState().noteContents[a]?.body).toBe('unsaved typing')
260260
expect(noteDiskRevision(a)).toBe(0)
261+
262+
// The typing above armed the debounced save; settle it here rather than
263+
// let it fire into a later test. The user's own write reaching disk is
264+
// not a disk change either.
265+
await useStore.getState().persistNote(a)
266+
expect(vault.get(a)).toBe('unsaved typing')
267+
expect(noteDiskRevision(a)).toBe(0)
261268
})
262269
})
263270

0 commit comments

Comments
 (0)