|
1 | 1 | import React from 'react' |
2 | 2 | import Mocked from '../__test_modules__/mocked' |
3 | 3 | import Unmocked from '../__test_modules__/unmocked' |
4 | | -// TODO: Enable when the 2nd TODO is fixed |
5 | | -// import a from '../__test_modules__/a' |
| 4 | +import a from '../__test_modules__/a' |
6 | 5 | import b from '../__test_modules__/b' |
7 | 6 | import c from '../__test_modules__/c' |
8 | 7 | import d from '../__test_modules__/d' |
@@ -48,18 +47,17 @@ jest.mock('virtual-module', () => 'kiwi', { virtual: true }) |
48 | 47 | jest.mock('has-flow-types', () => () => 3, { |
49 | 48 | virtual: true, |
50 | 49 | }) |
| 50 | +jest.mock('../__test_modules__/a') |
51 | 51 |
|
52 | 52 | // These will not be hoisted |
53 | 53 | jest.unmock('../__test_modules__/a').dontMock('../__test_modules__/b') |
54 | | -// eslint-disable-next-line no-useless-concat |
55 | | -jest.unmock('../__test_modules__/' + 'a') |
56 | 54 | jest.dontMock('../__test_modules__/mocked') |
57 | | -// TODO: This is a bug to fix |
58 | | -// { |
59 | | -// const jest = {unmock: () => {}}; |
60 | | -// // Would error (used before initialization) if hoisted to the top of the scope |
61 | | -// jest.unmock('../__test_modules__/a'); |
62 | | -// } |
| 55 | + |
| 56 | +{ |
| 57 | + const jest = { unmock: () => {} } |
| 58 | + // Would error (used before initialization) if hoisted to the top of the scope |
| 59 | + jest.unmock('../__test_modules__/a') |
| 60 | +} |
63 | 61 |
|
64 | 62 | // This must not throw an error |
65 | 63 | const myObject = { mock: () => {} } |
@@ -122,9 +120,8 @@ describe('hoisting', () => { |
122 | 120 | expect(Mocked._isMockFunction).toBe(true) |
123 | 121 | expect(new Mocked().isMocked).toEqual(undefined) |
124 | 122 |
|
125 | | - // TODO: Enable this once the TODO above is fixed |
126 | | - // expect(a._isMockFunction).toBe(true); |
127 | | - // expect(a()).toEqual(undefined); |
| 123 | + expect(a._isMockFunction).toBe(true) |
| 124 | + expect(a()).toEqual(undefined) |
128 | 125 |
|
129 | 126 | expect(b._isMockFunction).toBe(true) |
130 | 127 | expect(b()).toEqual(undefined) |
|
0 commit comments