Skip to content

Commit

Permalink
Add test for useProviderInfoDialog hook
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-slobodian committed Sep 20, 2024
1 parent cd8cbe5 commit 0b84428
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/dialogs/provider-info-dialog/useProviderInfoDialog.test.tsx
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);
});
});

0 comments on commit 0b84428

Please sign in to comment.