From a6dedb0b17f514e408919240c060072df2b179dd Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 18 Nov 2023 20:18:42 -0400 Subject: test: Track.color: mock fake album for updated wikiData validator --- test/unit/data/things/track.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'test/unit/data/things') diff --git a/test/unit/data/things/track.js b/test/unit/data/things/track.js index 806efbf1..51f86070 100644 --- a/test/unit/data/things/track.js +++ b/test/unit/data/things/track.js @@ -189,13 +189,14 @@ t.test(`Track.color`, t => { // connection breaks for some future reason (with the album still present), // Track.color should still inherit directly from the album. wikiData.albumData = [ - new Proxy({ + { + constructor: {[Thing.referenceType]: 'album'}, color: '#abcdef', tracks: [track], trackSections: [ {color: '#baaaad', tracks: []}, ], - }, {getPrototypeOf: () => Album.prototype}), + }, ]; linkWikiDataArrays(); -- cgit 1.3.0-6-gf8a5 From 9f58ba688c8a6ac3acf7b4bc435e2ccaed20b011 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Fri, 24 Nov 2023 15:01:33 -0400 Subject: test: isCommentary: basic unit test update --- test/unit/data/things/validators.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'test/unit/data/things') diff --git a/test/unit/data/things/validators.js b/test/unit/data/things/validators.js index bb33bf86..aa56a10e 100644 --- a/test/unit/data/things/validators.js +++ b/test/unit/data/things/validators.js @@ -149,13 +149,18 @@ t.test('isColor', t => { }); t.test('isCommentary', t => { - t.plan(6); + t.plan(9); + + // TODO: Test specific error messages. t.ok(isCommentary(`Toby Fox:\ndogsong.mp3`)); - t.ok(isCommentary(`Technically, this works:`)); - t.ok(isCommentary(`Whodunnit:`)); - t.throws(() => isCommentary(123), TypeError); - t.throws(() => isCommentary(``), TypeError); - t.throws(() => isCommentary(`Toby Fox:`)); + t.ok(isCommentary(`Toby Fox: (music)\ndogsong.mp3`)); + t.throws(() => isCommentary(`dogsong.mp3\nToby Fox:\ndogsong.mp3`)); + t.throws(() => isCommentary(`Toby Fox: dogsong.mp3`)); + t.throws(() => isCommentary(`Toby Fox: (music) dogsong.mp3`)); + t.throws(() => isCommentary(`I Have Nothing To Say:`)); + t.throws(() => isCommentary(123)); + t.throws(() => isCommentary(``)); + t.throws(() => isCommentary(`Technically, ah, er:\nCorrect`)); }); t.test('isContribution', t => { -- cgit 1.3.0-6-gf8a5