mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
test: use vi.spyOn for app.graph null guard test
Replace manual property assignment with vi.spyOn(app, 'graph', 'get') for cleaner mocking.
This commit is contained in:
@@ -115,10 +115,9 @@ describe('ChangeTracker', () => {
|
||||
const tracker = createTracker()
|
||||
const original = tracker.activeState
|
||||
|
||||
const savedGraph = app.graph
|
||||
;(app as { graph: unknown }).graph = null
|
||||
const spy = vi.spyOn(app, 'graph', 'get').mockReturnValue(null as never)
|
||||
tracker.captureCanvasState()
|
||||
;(app as { graph: unknown }).graph = savedGraph
|
||||
spy.mockRestore()
|
||||
|
||||
expect(app.rootGraph.serialize).not.toHaveBeenCalled()
|
||||
expect(tracker.activeState).toBe(original)
|
||||
|
||||
Reference in New Issue
Block a user