From 3b63c062e4e44e58c7d374a6e603e726b3167bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bertalan=20K=C3=B6rmendy?= Date: Thu, 12 Oct 2023 10:06:22 +0200 Subject: [PATCH] Check whether any actions introduced duplicate uids in `asyncTestDisaptch` (#4355) * expectNoActionsCausedDuplicateUids * update assertion numbers --- editor/src/components/canvas/ui-jsx.test-utils.tsx | 8 ++++++++ .../components/editor/store/dispatch-strategies.spec.tsx | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/editor/src/components/canvas/ui-jsx.test-utils.tsx b/editor/src/components/canvas/ui-jsx.test-utils.tsx index 296dece97112..f12ced343048 100644 --- a/editor/src/components/canvas/ui-jsx.test-utils.tsx +++ b/editor/src/components/canvas/ui-jsx.test-utils.tsx @@ -367,6 +367,8 @@ export async function renderTestEditorWithModel( ) } + expectNoActionsCausedDuplicateUids(actionsCausingDuplicateUIDs) + editorDispatchPromises.push(result.entireUpdateFinished) invalidateDomWalkerIfNecessary( domWalkerMutableState, @@ -695,6 +697,12 @@ function expectUpdatedFilesUpdateTimestamp( } } +function expectNoActionsCausedDuplicateUids( + actionsCausingDuplicateUIDs: ActionsCausingDuplicateUIDs, +) { + expect(actionsCausingDuplicateUIDs).toHaveLength(0) +} + export function getPrintedUiJsCode( store: EditorStorePatched, filePath: string = StoryboardFilePath, diff --git a/editor/src/components/editor/store/dispatch-strategies.spec.tsx b/editor/src/components/editor/store/dispatch-strategies.spec.tsx index 16ee325ffaa8..563a67f50884 100644 --- a/editor/src/components/editor/store/dispatch-strategies.spec.tsx +++ b/editor/src/components/editor/store/dispatch-strategies.spec.tsx @@ -953,6 +953,6 @@ describe('only update metadata on SAVE_DOM_REPORT', () => { ], ) - expect.assertions(6) // this ensures that the test fails if the expects inside the apply function are not called + expect.assertions(16) // this ensures that the test fails if the expects inside the apply function are not called }) })