-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for useProviderInfoDialog hook
- Loading branch information
1 parent
cd8cbe5
commit 0b84428
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
src/dialogs/provider-info-dialog/useProviderInfoDialog.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { renderHook, act } from "@testing"; | ||
import type { IProviderInfo } from "@peculiar/fortify-client-core"; | ||
import { useProviderInfoDialog } from "./useProviderInfoDialog"; | ||
|
||
describe("useProviderInfoDialog", () => { | ||
it("Should initialize", async () => { | ||
const { result } = renderHook(() => useProviderInfoDialog()); | ||
|
||
expect(result.current.dialog).toBeInstanceOf(Function); | ||
expect(result.current.open).toBeInstanceOf(Function); | ||
expect(result.current.close).toBeInstanceOf(Function); | ||
|
||
const provider = { | ||
name: "name-text", | ||
} as IProviderInfo; | ||
|
||
act(() => { | ||
result.current.open(provider); | ||
}); | ||
|
||
const DialogComponent = result.current.dialog(); | ||
|
||
expect(DialogComponent).not.toBeNull(); | ||
expect(DialogComponent?.props.data).toBe(provider); | ||
}); | ||
}); |