Skip to content

Commit

Permalink
fixup! Add tests for 269912f
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinnl committed Oct 6, 2020
1 parent 269912f commit 3da2a2b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test-types/top-level-jest-namespace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(jest.addMatchers({}));
expectType<typeof jest>(jest.autoMockOff());
Expand Down Expand Up @@ -37,6 +38,26 @@ expectType<typeof jest>(jest.resetModuleRegistry());
expectType<typeof jest>(jest.resetModules());
expectType<typeof jest>(jest.isolateModules(() => {}));
expectType<typeof jest>(jest.retryTimes(3));
expectType<JestMock.Mock<Promise<string>, []>>(
jest
.fn(() => Promise.resolve('string value'))
.mockResolvedValueOnce('A string, not a Promise'),
);
expectType<JestMock.Mock<Promise<string>, []>>(
jest
.fn(() => Promise.resolve('string value'))
.mockResolvedValue('A string, not a Promise'),
);
expectType<JestMock.Mock<Promise<string>, []>>(
jest
.fn(() => Promise.resolve('string value'))
.mockRejectedValueOnce(new Error('An error, not a string')),
);
expectType<JestMock.Mock<Promise<string>, []>>(
jest
.fn(() => Promise.resolve('string value'))
.mockRejectedValue(new Error('An error, not a string')),
);

expectType<void>(jest.runAllImmediates());
expectType<void>(jest.runAllTicks());
Expand Down

0 comments on commit 3da2a2b

Please sign in to comment.