diff --git a/.eslintrc.js b/.eslintrc.js index bd898af36a6..bab73c35167 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -52,7 +52,6 @@ module.exports = { radix: 'off', 'require-atomic-updates': 'off', - 'jest/expect-expect': 'off', 'jest/no-conditional-expect': 'off', 'jest/no-restricted-matchers': 'off', 'jest/no-test-return-statement': 'off', diff --git a/src/util.test.ts b/src/util.test.ts index 14c29c2f933..099042239a6 100644 --- a/src/util.test.ts +++ b/src/util.test.ts @@ -100,29 +100,35 @@ describe('util', () => { describe('safelyExecute', () => { it('should swallow errors', async () => { - await util.safelyExecute(() => { - throw new Error('ahh'); - }); + await expect( + util.safelyExecute(() => { + throw new Error('ahh'); + }), + ).resolves.toBeUndefined(); }); - it('should call retry function', () => { - return new Promise((resolve) => { + it('should call retry function', async () => { + const mockRetry = jest.fn(); + new Promise(() => { util.safelyExecute( () => { throw new Error('ahh'); }, false, - resolve, + mockRetry, ); }); + expect(mockRetry).toHaveBeenCalledWith(new Error('ahh')); }); }); describe('safelyExecuteWithTimeout', () => { it('should swallow errors', async () => { - await util.safelyExecuteWithTimeout(() => { - throw new Error('ahh'); - }); + await expect( + util.safelyExecuteWithTimeout(() => { + throw new Error('ahh'); + }), + ).resolves.toBeUndefined(); }); it('should resolve', async () => {