diff --git a/test-types/top-level-jest-namespace.test.ts b/test-types/top-level-jest-namespace.test.ts index 41be5aee551c..43f28aeea252 100644 --- a/test-types/top-level-jest-namespace.test.ts +++ b/test-types/top-level-jest-namespace.test.ts @@ -10,6 +10,7 @@ import {expectError, expectType} from 'mlh-tsd'; //eslint-disable-next-line import/no-extraneous-dependencies import {jest} from '@jest/globals'; +import JestMock = require('jest-mock'); expectType(jest.addMatchers({})); expectType(jest.autoMockOff()); @@ -37,6 +38,26 @@ expectType(jest.resetModuleRegistry()); expectType(jest.resetModules()); expectType(jest.isolateModules(() => {})); expectType(jest.retryTimes(3)); +expectType, []>>( + jest + .fn(() => Promise.resolve('string value')) + .mockResolvedValueOnce('A string, not a Promise'), +); +expectType, []>>( + jest + .fn(() => Promise.resolve('string value')) + .mockResolvedValue('A string, not a Promise'), +); +expectType, []>>( + jest + .fn(() => Promise.resolve('string value')) + .mockRejectedValueOnce(new Error('An error, not a string')), +); +expectType, []>>( + jest + .fn(() => Promise.resolve('string value')) + .mockRejectedValue(new Error('An error, not a string')), +); expectType(jest.runAllImmediates()); expectType(jest.runAllTicks());