Check in the tests that central files keep their full headers and that every tool has a compactor
tests/file-headers.test.mjs now fails when a source file over 300 lines lacks "Utilisé par :" and @see, when a listed central file lacks "Utilisé par :", or when a file adding methods through Object.assign does not say so. The eleven files below the bar are completed, so no waiting list is needed. tests/toolbox-compactors.test.mjs makes sure every tool type has a storage compactor, the gap found while documenting the toolboxes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d8c94f6834
commit
ae739b08ad
18 changed files with 184 additions and 25 deletions
21
tests/toolbox-compactors.test.mjs
Normal file
21
tests/toolbox-compactors.test.mjs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* @file Vérifie que chaque type d'outil du registre a son compacteur, et que le registre des compacteurs ne cite
|
||||
* aucun type inconnu.
|
||||
*
|
||||
* Attention : sans compacteur, `compactModuleDataForStorage` écrit les données d'un outil telles quelles, sans
|
||||
* erreur ; ce test est la seule protection contre cet oubli.
|
||||
* @see website/src/features/toolboxes/README.md
|
||||
*/
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import { test } from "node:test";
|
||||
import { TOOLBOX_MODULE_DEFINITIONS } from "../website/src/features/toolboxes/toolboxModuleRegistry.js";
|
||||
import { MODULE_DATA_COMPACTORS } from "../website/src/features/toolboxes/storage/modules/index.js";
|
||||
|
||||
test("every toolbox tool type has a storage compactor", () => {
|
||||
const types = Object.keys(TOOLBOX_MODULE_DEFINITIONS).sort();
|
||||
const compacted = Object.keys(MODULE_DATA_COMPACTORS).sort();
|
||||
assert.deepEqual(types.filter((type) => !compacted.includes(type)), [], "Add a compactor in storage/modules/index.js for these tool types");
|
||||
assert.deepEqual(compacted.filter((type) => !types.includes(type)), [], "These compactors name tool types missing from toolboxModuleRegistry.js");
|
||||
for (const type of compacted) assert.equal(typeof MODULE_DATA_COMPACTORS[type], "function", type);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue