Skip to content

Commit

Permalink
test: add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Wxh16144 committed Mar 7, 2024
1 parent 8ff974e commit db6bbad
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/__snapshots__/export.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`export > should work 1`] = `
[
"useBoolean",
"useLatestFunc",
"useModalEnhanced",
"has",
"omit",
"isElement",
"isDOMTypeElement",
"AntdMobile",
"DragModal",
"Drawer",
"EasyAntdModalProvider",
"Modal",
"useEasyAntdModal",
"default",
"Antd",
]
`;
32 changes: 32 additions & 0 deletions tests/export.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
describe('export', () => {
it('should work', async () => {
const all = await import('easy-antd-modal');

expect(Object.keys(all)).toMatchSnapshot();
});

it('should export all hooks', async () => {
const hooks = await import('easy-antd-modal/hooks');

expect(Object.keys(hooks)).toMatchInlineSnapshot(`
[
"useBoolean",
"useLatestFunc",
"useModalEnhanced",
]
`);
});

it('should export all utils', async () => {
const types = await import('easy-antd-modal/util');

expect(Object.keys(types)).toMatchInlineSnapshot(`
[
"has",
"omit",
"isElement",
"isDOMTypeElement",
]
`);
});
});

0 comments on commit db6bbad

Please sign in to comment.