« get me outta code hell

test: update withParsedCommentaryEntries (unit) - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/test/unit/data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-23 22:36:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-23 22:36:14 -0300
commit86a58ef13ecdddbda41f6ce3ce5580d3a78d1a61 (patch)
tree193245e35e8daa8e093156beadd8ca628ba3e7b0 /test/unit/data
parent627ac1289a248f542ae7908e9357cbb862c1bd66 (diff)
test: update withParsedCommentaryEntries (unit)
Diffstat (limited to 'test/unit/data')
-rw-r--r--test/unit/data/composite/wiki-data/withParsedCommentaryEntries.js205
1 files changed, 204 insertions, 1 deletions
diff --git a/test/unit/data/composite/wiki-data/withParsedCommentaryEntries.js b/test/unit/data/composite/wiki-data/withParsedCommentaryEntries.js
index 572eed49..411fd11d 100644
--- a/test/unit/data/composite/wiki-data/withParsedCommentaryEntries.js
+++ b/test/unit/data/composite/wiki-data/withParsedCommentaryEntries.js
@@ -28,7 +28,7 @@ function stubArtist(artistName = `Test Artist`) {
 }
 
 t.test(`withParsedCommentaryEntries: basic behavior`, t => {
-  t.plan(4);
+  t.plan(7);
 
   const artist1 = stubArtist(`Mobius Trip`);
   const artist2 = stubArtist(`Hadron Kaleido`);
@@ -56,6 +56,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       date: null,
       accessDate: null,
       accessKind: null,
+      secondDate: null,
+      dateKind: null,
       body: `Some commentary.\nVery cool.`,
     },
   ]);
@@ -79,6 +81,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: `music, art`,
       date: new Date('12 January 2015'),
       body: `First commentary entry.\nVery cool.`,
+      secondDate: null,
+      dateKind: null,
       accessDate: null,
       accessKind: null,
     },
@@ -88,6 +92,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: `moral support`,
       date: new Date('4 April 2022'),
       body: `Second commentary entry. Yes. So cool.`,
+      secondDate: null,
+      dateKind: null,
       accessDate: null,
       accessKind: null,
     },
@@ -97,6 +103,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: `pingas`,
       date: new Date('25 August 2023'),
       body: `Oh no.. Oh dear...`,
+      secondDate: null,
+      dateKind: null,
       accessDate: null,
       accessKind: null,
     },
@@ -106,6 +114,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: null,
       date: null,
       body: `And back around we go.`,
+      secondDate: null,
+      dateKind: null,
       accessDate: null,
       accessKind: null,
     },
@@ -136,6 +146,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       body:
         `Written by [[artist:michael-guy-bowman|Michael Guy Bowman]]<br>\n` +
         `Arrangement by [[artist:mark-j-hadley|Mark Hadley]]`,
+      secondDate: null,
+      dateKind: null,
       accessDate: new Date('10/24/2020'),
       accessKind: 'captured',
     },
@@ -145,6 +157,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
       date: new Date('7/20/2019'),
       body: `This isn't real!`,
+      secondDate: null,
+      dateKind: null,
       accessDate: new Date('4/13/2024'),
       accessKind: 'captured',
     },
@@ -154,6 +168,8 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: `[fake](https://homestuck.com/fake)`,
       date: new Date('10/25/2011'),
       body: `This isn't real either!`,
+      secondDate: null,
+      dateKind: null,
       accessDate: new Date('10/27/2011'),
       accessKind: 'accessed',
     },
@@ -163,6 +179,193 @@ t.test(`withParsedCommentaryEntries: basic behavior`, t => {
       annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
       date: new Date('7/20/2019'),
       body: `Not this one, neither!`,
+      secondDate: null,
+      dateKind: null,
+      accessDate: new Date('4/13/2024'),
+      accessKind: 'accessed',
+    },
+  ]);
+
+  t.same(composite.expose.compute({
+    artistData,
+    from:
+      `<i>Homestuck:</i> ([MSPA sound credits](https://web.archive.org/web/20120805031705/http://www.mspaintadventures.com:80/soundcredits.html), sometime 6/21/2012 - 8/5/2012)\n` +
+      `\n` +
+      `[[flash:246|Page 2146]] - <b>"Sburban Countdown"</b><br>\n` +
+      `Available on Bandcamp in [[album:homestuck-vol-1-4|Homestuck Vol. 1-4]]<br>\n` +
+      `Written by [[artist:michael-guy-bowman|Michael Guy Bowman]]<br>\n` +
+      `Arrangement by [[artist:mark-j-hadley|Mark Hadley]]\n` +
+      `\n` +
+      `<i>Homestuck:</i> ([fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake), 7/20/2019 - 7/20/2022 captured 4/13/2024)\n` +
+      `It's goin' once.\n` +
+      `\n` +
+      `<i>Homestuck:</i> (10/25/2011 - 10/28/2011 accessed 10/27/2011)\n` +
+      `It's goin' twice.\n` +
+      `\n` +
+      `<i>Homestuck:</i> ([fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake), 7/20/2019 - 7/20/2022 accessed 4/13/2024)\n` +
+      `It's goin' thrice!\n`
+  }), [
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[MSPA sound credits](https://web.archive.org/web/20120805031705/http://www.mspaintadventures.com:80/soundcredits.html)`,
+      body:
+        `[[flash:246|Page 2146]] - <b>"Sburban Countdown"</b><br>\n` +
+        `Available on Bandcamp in [[album:homestuck-vol-1-4|Homestuck Vol. 1-4]]<br>\n` +
+        `Written by [[artist:michael-guy-bowman|Michael Guy Bowman]]<br>\n` +
+        `Arrangement by [[artist:mark-j-hadley|Mark Hadley]]`,
+      date: new Date('6/21/2012'),
+      secondDate: new Date('8/5/2012'),
+      dateKind: 'sometime',
+      accessDate: new Date('8/5/2012'),
+      accessKind: 'captured',
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
+      body: `It's goin' once.`,
+      date: new Date('7/20/2019'),
+      secondDate: new Date('7/20/2022'),
+      dateKind: null,
+      accessDate: new Date('4/13/2024'),
+      accessKind: 'captured',
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: '', // TODO: This should be null, but the regex isn't structured for that, at the moment.
+      body: `It's goin' twice.`,
+      date: new Date('10/25/2011'),
+      secondDate: new Date('10/28/2011'),
+      dateKind: null,
+      accessDate: new Date('10/27/2011'),
+      accessKind: 'accessed',
+
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
+      body: `It's goin' thrice!`,
+      date: new Date('7/20/2019'),
+      secondDate: new Date('7/20/2022'),
+      dateKind: null,
+      accessDate: new Date('4/13/2024'),
+      accessKind: 'accessed',
+    },
+  ]);
+
+  t.same(composite.expose.compute({
+    artistData,
+    from:
+      `<i>Homestuck:</i> ([MSPA sound credits](https://web.archive.org/web/20120805031705/http://www.mspaintadventures.com:80/soundcredits.html), sometime 6/21/2012 - 8/5/2012)\n` +
+      `\n` +
+      `[[flash:246|Page 2146]] - <b>"Sburban Countdown"</b><br>\n` +
+      `Available on Bandcamp in [[album:homestuck-vol-1-4|Homestuck Vol. 1-4]]<br>\n` +
+      `Written by [[artist:michael-guy-bowman|Michael Guy Bowman]]<br>\n` +
+      `Arrangement by [[artist:mark-j-hadley|Mark Hadley]]\n` +
+      `\n` +
+      `<i>Homestuck:</i> ([fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake), 7/20/2019 - 7/20/2022 captured 4/13/2024)\n` +
+      `It's goin' once.\n` +
+      `\n` +
+      `<i>Homestuck:</i> (10/25/2011 - 10/28/2011 accessed 10/27/2011)\n` +
+      `It's goin' twice.\n` +
+      `\n` +
+      `<i>Homestuck:</i> ([fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake), 7/20/2019 - 7/20/2022 accessed 4/13/2024)\n` +
+      `It's goin' thrice!\n`
+  }), [
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[MSPA sound credits](https://web.archive.org/web/20120805031705/http://www.mspaintadventures.com:80/soundcredits.html)`,
+      body:
+        `[[flash:246|Page 2146]] - <b>"Sburban Countdown"</b><br>\n` +
+        `Available on Bandcamp in [[album:homestuck-vol-1-4|Homestuck Vol. 1-4]]<br>\n` +
+        `Written by [[artist:michael-guy-bowman|Michael Guy Bowman]]<br>\n` +
+        `Arrangement by [[artist:mark-j-hadley|Mark Hadley]]`,
+      date: new Date('6/21/2012'),
+      secondDate: new Date('8/5/2012'),
+      dateKind: 'sometime',
+      accessDate: new Date('8/5/2012'),
+      accessKind: 'captured',
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
+      body: `It's goin' once.`,
+      date: new Date('7/20/2019'),
+      secondDate: new Date('7/20/2022'),
+      dateKind: null,
+      accessDate: new Date('4/13/2024'),
+      accessKind: 'captured',
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: '', // TODO: This should be null, but the regex isn't structured for that, at the moment.
+      body: `It's goin' twice.`,
+      date: new Date('10/25/2011'),
+      secondDate: new Date('10/28/2011'),
+      dateKind: null,
+      accessDate: new Date('10/27/2011'),
+      accessKind: 'accessed',
+
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
+      body: `It's goin' thrice!`,
+      date: new Date('7/20/2019'),
+      secondDate: new Date('7/20/2022'),
+      dateKind: null,
+      accessDate: new Date('4/13/2024'),
+      accessKind: 'accessed',
+    },
+  ]);
+
+  t.same(composite.expose.compute({
+    artistData,
+    from:
+      `<i>Homestuck:</i> ([Homestuck sound credits](https://web.archive.org/web/20180717171235/https://www.homestuck.com/credits/sound), excerpt, around 4/3/2018)\n` +
+      `blablabla\n` +
+      `<i>Homestuck:</i> ([fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake), around 7/20/2019 - 7/20/2022 captured 4/13/2024)\n` +
+      `Snoopin', snoopin', snoo,\n` +
+      `<i>Homestuck:</i> ([fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake), throughout 7/20/2019 - 7/20/2022 accessed 4/13/2024)\n` +
+      `~ pingas ~\n`
+  }), [
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[Homestuck sound credits](https://web.archive.org/web/20180717171235/https://www.homestuck.com/credits/sound), excerpt`,
+      body: `blablabla`,
+      date: new Date('4/3/2018'),
+      secondDate: null,
+      dateKind: 'around',
+      accessDate: new Date('7/17/2018'),
+      accessKind: 'captured',
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
+      body: `Snoopin', snoopin', snoo,`,
+      date: new Date('7/20/2019'),
+      secondDate: new Date('7/20/2022'),
+      dateKind: 'around',
+      accessDate: new Date('4/13/2024'),
+      accessKind: 'captured',
+    },
+    {
+      artists: [artist3],
+      artistDisplayText: null,
+      annotation: `[fake](https://web.archive.org/web/20201024170202/https://homestuck.bandcamp.com/fake)`,
+      body: `~ pingas ~`,
+      date: new Date('7/20/2019'),
+      secondDate: new Date('7/20/2022'),
+      dateKind: 'throughout',
       accessDate: new Date('4/13/2024'),
       accessKind: 'accessed',
     },