// The licence rule's SPDX evaluator (scripts/deps.mjs). Run: node --test scripts/deps.test.mjs import { test } from 'node:test'; import assert from 'node:assert/strict'; import { allowed } from './deps.mjs'; test('the allowed licences pass', () => { for (const l of ['MIT', 'Apache-2.0', 'BSD-3-Clause', 'Zlib', 'MPL-2.0', 'ISC', 'Unicode-3.0', 'MIT OR Apache-2.0', 'MIT/Apache-2.0', '(MIT OR Apache-2.0) AND Unicode-3.0', 'Apache-2.0 WITH LLVM-exception']) assert.ok(allowed(l), l); }); test('copyleft, non-commercial and missing licences fail', () => { for (const l of ['GPL-3.0', 'AGPL-3.0-only', 'LGPL-2.1', 'CC-BY-NC-4.0', 'MIT AND GPL-2.0', '', undefined, 'SSPL-1.0', 'OpenSSL']) assert.equal(allowed(l), false, String(l)); }); test('OR needs one allowed branch, AND needs all', () => { assert.ok(allowed('GPL-2.0 OR MIT')); assert.equal(allowed('GPL-2.0 AND MIT'), false); assert.ok(allowed('(GPL-2.0 OR MIT) AND Apache-2.0')); });