Skip to content

Commit

Permalink
Check whether any actions introduced duplicate uids in `asyncTestDisa…
Browse files Browse the repository at this point in the history
…ptch` (#4355)

* expectNoActionsCausedDuplicateUids

* update assertion numbers
  • Loading branch information
bkrmendy authored Oct 12, 2023
1 parent 603552b commit 3b63c06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions editor/src/components/canvas/ui-jsx.test-utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ export async function renderTestEditorWithModel(
)
}

expectNoActionsCausedDuplicateUids(actionsCausingDuplicateUIDs)

editorDispatchPromises.push(result.entireUpdateFinished)
invalidateDomWalkerIfNecessary(
domWalkerMutableState,
Expand Down Expand Up @@ -695,6 +697,12 @@ function expectUpdatedFilesUpdateTimestamp(
}
}

function expectNoActionsCausedDuplicateUids(
actionsCausingDuplicateUIDs: ActionsCausingDuplicateUIDs,
) {
expect(actionsCausingDuplicateUIDs).toHaveLength(0)
}

export function getPrintedUiJsCode(
store: EditorStorePatched,
filePath: string = StoryboardFilePath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
})

0 comments on commit 3b63c06

Please sign in to comment.