Skip to content

Commit efb4142

Browse files
committed
chore: search input tests
1 parent 36f1cfc commit efb4142

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/jest/view/plugin/search/search.test.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,23 @@ describe('Search plugin', () => {
7171
const input = wrapper.find('input');
7272
const onInput = input.props().onInput;
7373

74-
act(() => {
74+
await act(() => {
7575
const htmlInputElement = document.createElement('input');
7676
htmlInputElement.value = '123';
7777
onInput({ target: htmlInputElement });
7878
});
7979

8080
wrapper.update();
8181

82-
await flushPromises();
83-
await flushPromises();
8482
await flushPromises();
8583

86-
expect(mock).toBeCalledWith('123');
84+
return new Promise<void>((resolve) => {
85+
// TODO: can we fix this and remove the setTimeout?
86+
setTimeout(() => {
87+
expect(mock).toBeCalledWith('123');
88+
resolve();
89+
}, 100);
90+
});
8791
});
8892

8993
it('should add config.className.search', async () => {

0 commit comments

Comments
 (0)