Skip to content

Commit f0c917d

Browse files
chore(deps): update dependency eslint-plugin-jest to v24.7.0 (#734)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Sarah Dayan <[email protected]>
1 parent e7c8429 commit f0c917d

File tree

3 files changed

+24
-27
lines changed

3 files changed

+24
-27
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"eslint-config-prettier": "6.15.0",
6060
"eslint-plugin-eslint-comments": "3.2.0",
6161
"eslint-plugin-import": "2.22.1",
62-
"eslint-plugin-jest": "24.1.3",
62+
"eslint-plugin-jest": "24.7.0",
6363
"eslint-plugin-prettier": "3.4.1",
6464
"eslint-plugin-react": "7.32.2",
6565
"eslint-plugin-react-hooks": "4.6.0",

packages/autocomplete-core/src/__tests__/getInputProps.test.ts

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -565,29 +565,33 @@ describe('getInputProps', () => {
565565
});
566566
});
567567

568-
/* eslint-disable-next-line jest/no-done-callback */
569-
test('lets user handle the errors', (done) => {
570-
const getSources = jest.fn((..._args: any[]) => {
571-
return [
572-
createSource({
573-
getItems() {
574-
return new Promise<any>((resolve, reject) => {
575-
reject(new Error('Fetch error'));
576-
}).catch((err) => {
577-
expect(err).toEqual(expect.any(Error));
578-
done();
579-
return [];
580-
});
581-
},
582-
}),
583-
];
584-
});
568+
test('lets user handle the errors', async () => {
569+
const onError = jest.fn();
585570

586571
const { inputElement } = createPlayground(createAutocomplete, {
587-
getSources,
572+
getSources: jest.fn(() => {
573+
return [
574+
createSource({
575+
getItems() {
576+
return new Promise<any>((_, reject) => {
577+
reject(new Error('Fetch error'));
578+
}).catch((err) => {
579+
onError(err);
580+
581+
return [];
582+
});
583+
},
584+
}),
585+
];
586+
}),
588587
});
589588

590589
userEvent.type(inputElement, 'a');
590+
591+
await runAllMicroTasks();
592+
593+
expect(onError).toHaveBeenCalledTimes(1);
594+
expect(onError).toHaveBeenCalledWith(new Error('Fetch error'));
591595
});
592596

593597
test('clears stalled timeout', async () => {

yarn.lock

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8682,14 +8682,7 @@ eslint-plugin-import@^2.22.1:
86828682
resolve "^1.20.0"
86838683
tsconfig-paths "^3.12.0"
86848684

8685-
8686-
version "24.1.3"
8687-
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.1.3.tgz#fa3db864f06c5623ff43485ca6c0e8fc5fe8ba0c"
8688-
integrity sha512-dNGGjzuEzCE3d5EPZQ/QGtmlMotqnYWD/QpCZ1UuZlrMAdhG5rldh0N0haCvhGnUkSeuORS5VNROwF9Hrgn3Lg==
8689-
dependencies:
8690-
"@typescript-eslint/experimental-utils" "^4.0.1"
8691-
8692-
eslint-plugin-jest@^24.1.0:
8685+
[email protected], eslint-plugin-jest@^24.1.0:
86938686
version "24.7.0"
86948687
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.7.0.tgz#206ac0833841e59e375170b15f8d0955219c4889"
86958688
integrity sha512-wUxdF2bAZiYSKBclsUMrYHH6WxiBreNjyDxbRv345TIvPeoCEgPNEn3Sa+ZrSqsf1Dl9SqqSREXMHExlMMu1DA==

0 commit comments

Comments
 (0)