Explorar o código

test: add test for SignOutDialog Cancel button

Ensure that clicking the Cancel button does not trigger
reset or navigation actions in the SignOutDialog component.
satnaing hai 2 meses
pai
achega
b212358e0a
Modificáronse 1 ficheiros con 11 adicións e 0 borrados
  1. 11 0
      src/components/sign-out-dialog.test.tsx

+ 11 - 0
src/components/sign-out-dialog.test.tsx

@@ -42,4 +42,15 @@ describe('SignOutDialog', () => {
       replace: true,
     })
   })
+
+  it('does not call reset or navigate when Cancel is clicked', async () => {
+    const { getByRole } = await render(
+      <SignOutDialog open onOpenChange={vi.fn()} />
+    )
+
+    await userEvent.click(getByRole('button', { name: /^Cancel$/i }))
+
+    expect(reset).not.toHaveBeenCalled()
+    expect(navigate).not.toHaveBeenCalled()
+  })
 })