diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-10-15 15:33:16 -0300 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-10-15 15:33:16 -0300 |
| commit | 0bb3fe00bd9cd5fa90466975795fe45ed6bf2b96 (patch) | |
| tree | cd02b892a88c256cb60e7e2f6b5b16b10ed53e4f | |
| parent | 6a62e47e1e2dd928de0d5473c4c9dc5ef25fdce6 (diff) | |
validators, test: permissive typeless validateReference()
Test appears to describe that the original behavior would have been to default to 'track', which like... okay?? That is so and was changed (to no default and arbitrary typeless behavior) in commit 4f6e0bc3.
| -rw-r--r-- | src/validators.js | 8 | ||||
| -rw-r--r-- | test/unit/data/validators.js | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/validators.js b/src/validators.js index 59df80d4..63268ded 100644 --- a/src/validators.js +++ b/src/validators.js @@ -842,9 +842,11 @@ export function validateReference(type) { type.map(type => `"${type}:"`).join(', ') + `, got "${typePart}:"`); } - } else if (typePart !== type) { - throw new TypeError( - `Expected ref to begin with "${type}:", got "${typePart}:"`); + } else if (type) { + if (typePart !== type) { + throw new TypeError( + `Expected ref to begin with "${type}:", got "${typePart}:"`); + } } isDirectory(directoryPart); diff --git a/test/unit/data/validators.js b/test/unit/data/validators.js index f5565c0b..02f94866 100644 --- a/test/unit/data/validators.js +++ b/test/unit/data/validators.js @@ -374,8 +374,8 @@ test(t, 'validateReference', t => { t.ok(typeless('Hopes and Dreams')); t.ok(typeless('track:snowdin-town')); + t.ok(typeless('album:undertale-soundtrack')); t.throws(() => typeless(''), TypeError); - t.throws(() => typeless('album:undertale-soundtrack')); }); test(t, 'validateReferenceList', t => { |