|
1 | | -// Copyright (c) Music Blocks |
2 | | -// |
3 | | -// This program is free software; you can redistribute it and/or |
4 | | -// modify it under the terms of the The GNU Affero General Public |
5 | | -// License as published by the Free Software Foundation; either |
6 | | -// version 3 of the License, or (at your option) any later version. |
7 | | -// |
8 | | -// You should have received a copy of the GNU Affero General Public |
9 | | -// License along with this library; if not, write to the Free Software |
10 | | -// Foundation, 51 Franklin Street, Suite 500 Boston, MA 02110-1335 USA |
11 | | - |
12 | | -// ─── WHY THIS FILE IS STRUCTURED THIS WAY ──────────────────────────────────── |
13 | | -// |
14 | | -// loader.js is a *script*, not a module: the moment Jest's require() evaluates |
15 | | -// it, the top-level requirejs([...], callback) fires synchronously. |
16 | | -// If a real (or uncontrolled) requirejs is on global at that point, it spawns |
17 | | -// its own describe/test calls mid-test — causing Jest's fatal |
18 | | -// "Tests cannot be nested" error seen in the previous run. |
19 | | -// |
20 | | -// Fix: install ONE Proxy-based stub on global.requirejs BEFORE any describe() |
21 | | -// block is entered. The proxy delegates to a mutable `_mockImpl` pointer that |
22 | | -// each test replaces via beforeEach. jest.resetModules() gives every test a |
23 | | -// fresh loader.js execution while the proxy itself stays stable on global. |
24 | | -// ───────────────────────────────────────────────────────────────────────────── |
| 1 | +/** |
| 2 | + * @license |
| 3 | + * MusicBlocks v3.4.1 |
| 4 | + * Copyright (C) 2026 Ashutosh Kumar |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Affero General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Affero General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Affero General Public License |
| 17 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +/** |
| 21 | + * Tests for loader.js module |
| 22 | + * |
| 23 | + * The loader.js file is an entry point that uses RequireJS to load the application. |
| 24 | + * Since it executes immediately upon require and depends on external modules (i18next), |
| 25 | + * we test its configuration and behavior through mocks. |
| 26 | + */ |
25 | 27 |
|
26 | 28 | let _mockImpl = jest.fn(); |
27 | 29 |
|
|
0 commit comments