Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/core/src/store/draft-attachment-snapshot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ test('draft snapshots do not enumerate unaffected procedural attachment maps', (
]
}),
]) as Record<AnyNodeId, AnyNode>
// `updateNode` batches its dirty-node flush through rAF, which bun's test
// runtime has no DOM to supply. Every other core test that reaches this path
// stubs it; this one used to pass only when one of them happened to run first
// and leak the global, so on a runner that ordered the files differently it
// failed with a bare ReferenceError.
const savedRaf = globalThis.requestAnimationFrame
const savedCancelRaf = globalThis.cancelAnimationFrame
globalThis.requestAnimationFrame = (() => 0) as typeof requestAnimationFrame
globalThis.cancelAnimationFrame = (() => {}) as typeof cancelAnimationFrame
const stop = subscribeSceneCommits((commit) => {
expect(commit.current.nodes[draft.id]).toBeUndefined()
expect((commit.current.nodes['procedural-item_0'] as ProceduralItemNode).attachments).toBe(
Expand Down Expand Up @@ -68,5 +77,7 @@ test('draft snapshots do not enumerate unaffected procedural attachment maps', (
useScene.setState(saved)
useScene.temporal.getState().clear()
useScene.temporal.getState().resume()
globalThis.requestAnimationFrame = savedRaf
globalThis.cancelAnimationFrame = savedCancelRaf
}
})
Loading