From 3da2a2b9aa60bb9cc5005489207ad562c9442b55 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 6 Oct 2020 11:31:35 +0200 Subject: [PATCH] fixup! Add tests for 269912f08903ba9543968c7cbcecce2c1f9c974e --- test-types/top-level-jest-namespace.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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());