Skip to content

Commit 508c291

Browse files
arbrandesclaude
andcommitted
style: add explanatory comments for late imports after jest.mock()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 06f696a commit 508c291

5 files changed

Lines changed: 10 additions & 0 deletions

File tree

src/login/tests/LoginPage.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jest.mock('@openedx/frontend-base', () => ({
3030
getAuthService: jest.fn(),
3131
}));
3232

33+
// jest.mock() must be called before importing the mocked module's members,
34+
// so this import intentionally comes after the mock declaration above.
3335
// eslint-disable-next-line import/first
3436
import { sendPageEvent, sendTrackEvent } from '@openedx/frontend-base';
3537

src/register/RegistrationPage.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jest.mock('@openedx/frontend-base', () => ({
4444
getLocale: jest.fn(),
4545
}));
4646

47+
// jest.mock() must be called before importing the mocked module's members,
48+
// so this import intentionally comes after the mock declaration above.
4749
// eslint-disable-next-line import/first
4850
import { getLocale, sendPageEvent, sendTrackEvent } from '@openedx/frontend-base';
4951

src/register/components/tests/ConfigurableRegistrationForm.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jest.mock('@openedx/frontend-base', () => ({
2020
getLocale: jest.fn(),
2121
}));
2222

23+
// jest.mock() must be called before importing the mocked module's members,
24+
// so this import intentionally comes after the mock declaration above.
2325
// eslint-disable-next-line import/first
2426
import { getLocale } from '@openedx/frontend-base';
2527

src/register/components/tests/RegistrationFailure.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jest.mock('@openedx/frontend-base', () => ({
2222
getLocale: jest.fn(),
2323
}));
2424

25+
// jest.mock() must be called before importing the mocked module's members,
26+
// so this import intentionally comes after the mock declaration above.
2527
// eslint-disable-next-line import/first
2628
import { getLocale } from '@openedx/frontend-base';
2729

src/register/components/tests/ThirdPartyAuth.test.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jest.mock('@openedx/frontend-base', () => ({
2121
getLocale: jest.fn(),
2222
}));
2323

24+
// jest.mock() must be called before importing the mocked module's members,
25+
// so this import intentionally comes after the mock declaration above.
2426
// eslint-disable-next-line import/first
2527
import { getLocale } from '@openedx/frontend-base';
2628

0 commit comments

Comments
 (0)