Skip to content

Commit ab544bd

Browse files
committed
让测试通过
1 parent 3054368 commit ab544bd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/testHook.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import React from 'react';
2+
import { shallow } from 'enzyme';
3+
4+
function testHook(hook) {
5+
let output;
6+
function HookWrapper() {
7+
output = hook();
8+
return <></>;
9+
}
10+
shallow(<HookWrapper />);
11+
return output;
12+
}
13+
14+
export default testHook;

src/useModalManagement.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import useModalManagement from './useModalManagement';
2+
import testHook from './testHook';
23

34
describe('The useModalManagement hook', () => {
45
it('should not throw an error', () => {
5-
useModalManagement();
6+
testHook(useModalManagement);
67
});
78
});

0 commit comments

Comments
 (0)