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", () => {