kolibri
kolibri copied to clipboard
Recurring review comment: Mock and global restoration in tests
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Reviewers raised this on 4 PRs by 3 authors in the last 90 days: Mock and global restoration in tests.
Proposal
AGENTS.md: "Replace globals with jest.spyOn and call jest.restoreAllMocks() in afterEach; assert outside mocked callbacks. Use it.each instead of loops or manual unmount() inside one it." Lint: jest/no-conditional-expect.
Comments
- https://github.com/learningequality/kolibri/pull/15496#discussion_r4178677144 (#15496,
packages/kolibri-common/components/draggable/__tests__/DraggableRegionHorizontal.spec.js) - https://github.com/learningequality/kolibri/pull/15472#discussion_r4166683785 (#15472,
packages/kolibri/components/__tests__/download-button.spec.js) - https://github.com/learningequality/kolibri/pull/15468#discussion_r4166620939 (#15468,
kolibri/plugins/coach/frontend/views/common/notifications/__tests__/NotificationCard.spec.js) - https://github.com/learningequality/kolibri/pull/15461#discussion_r4166495199 (#15461,
packages/kolibri-common/components/quizzes/QuizReport/__tests__/current-try-overview.spec.js)
Consolidated into #15608.