Skip to content

Commit

Permalink
test: Always wait for motion ended
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Mar 29, 2021
1 parent 49162f9 commit a1baecb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ exports[`Upload List handle error 1`] = `
class="ant-upload-list ant-upload-list-text"
>
<div
class="ant-upload-list-text-container ant-upload-animate-appear ant-upload-animate-appear-start ant-upload-animate"
style="height: 0px; opacity: 0;"
class="ant-upload-list-text-container ant-upload-animate-appear ant-upload-animate-appear-active ant-upload-animate"
style="height: 0px; opacity: 1;"
>
<div
class="ant-upload-list-item ant-upload-list-item-error ant-upload-list-item-list-type-text"
Expand Down
12 changes: 9 additions & 3 deletions components/upload/__tests__/uploadlist.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,10 @@ describe('Upload List', () => {
});

// Wait twice since `errorRequest` also use timeout for mock
await sleep();
await sleep();
await act(async () => {
await sleep();
await sleep();
});

expect(onChange).toHaveBeenLastCalledWith(
expect.objectContaining({
Expand All @@ -212,7 +214,11 @@ describe('Upload List', () => {
}),
);

wrapper.update();
await act(async () => {
await sleep(1000);
wrapper.update();
});

expect(wrapper.render()).toMatchSnapshot();

// Error message
Expand Down

0 comments on commit a1baecb

Please sign in to comment.