From 9c8c2cf30524a7e3c284c3480dc40364435d3a33 Mon Sep 17 00:00:00 2001 From: Shinuwa Date: Fri, 30 Oct 2026 10:25:23 +0100 Subject: [PATCH] Make Aniimo unknown-role tests self-contained --- tests/aniimo.test.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/aniimo.test.mjs b/tests/aniimo.test.mjs index a785bad..96c32d8 100644 --- a/tests/aniimo.test.mjs +++ b/tests/aniimo.test.mjs @@ -48,13 +48,17 @@ test("validation requires regional uids and explicitly documented unknown roles" entry.uid = entry.id; assert.throws(() => validateAniimoData([entry], [fr, en]), /uid must combine/); assert.throws(() => validateAniimoData([aniimos[0], aniimos[0]], [fr, en]), /Duplicate Aniimo uid/); - const pending = structuredClone(aniimos.find((v) => v.variations.some((form) => form.role === null))); + const pending = structuredClone(aniimos[0]); + pending.variations[0].role = null; + pending.variations[0].verification = "pending"; + pending.variations[0].data_gaps = ["role_not_verified"]; validateAniimoData([pending], [fr, en]); + const pendingData = prepareAniimoData([pending], fr, en); delete pending.variations.find((v) => v.role === null).data_gaps; assert.throws(() => validateAniimoData([pending], [fr, en]), /Unknown role must/); - assert.ok(!data.filterOptions.roles.includes(null)); - assert.ok(filter({ roles: data.filterOptions.roles }).every((v) => v.role !== null)); - assert.ok(filter({}).some((v) => v.role === null)); + assert.ok(!pendingData.filterOptions.roles.includes(null)); + assert.ok(filter({ roles: pendingData.filterOptions.roles }, pendingData.variants).every((v) => v.role !== null)); + assert.ok(filter({}, pendingData.variants).some((v) => v.role === null)); }); test("Sparkelf uses only its current French and English names", () => {