diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-03-25 14:21:24 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-03-25 14:21:24 -0300 |
commit | fc5d4d057b1e18e3e5c91bce1ddb545bc9d91db9 (patch) | |
tree | 98be0d171871a0fb553680d42be4f6056fc81827 /test | |
parent | fad524ed133af6f094357b94da54e616c7f943b6 (diff) |
data steps: port tests to tap instead of tape
Diffstat (limited to 'test')
-rw-r--r-- | test/cacheable-object.js | 66 | ||||
-rw-r--r-- | test/data-validators.js | 84 | ||||
-rw-r--r-- | test/html.js | 140 | ||||
-rw-r--r-- | test/things.js | 14 |
4 files changed, 149 insertions, 155 deletions
diff --git a/test/cacheable-object.js b/test/cacheable-object.js index 30083fef..0dab9913 100644 --- a/test/cacheable-object.js +++ b/test/cacheable-object.js @@ -1,18 +1,14 @@ -import test from 'tape'; +import t from 'tap'; import CacheableObject from '../src/data/things/cacheable-object.js'; -// Utility - function newCacheableObject(PD) { return new (class extends CacheableObject { static propertyDescriptors = PD; }); } -// Tests - -test(`CacheableObject simple separate update & expose`, t => { +t.test(`CacheableObject simple separate update & expose`, t => { const obj = newCacheableObject({ number: { flags: { @@ -37,7 +33,7 @@ test(`CacheableObject simple separate update & expose`, t => { t.equal(obj.timesTwo, 10); }); -test(`CacheableObject basic cache behavior`, t => { +t.test(`CacheableObject basic cache behavior`, t => { let computeCount = 0; const obj = newCacheableObject({ @@ -64,31 +60,31 @@ test(`CacheableObject basic cache behavior`, t => { t.plan(8); - t.is(computeCount, 0); + t.equal(computeCount, 0); obj.string = 'hello world'; - t.is(computeCount, 0); + t.equal(computeCount, 0); obj.karkat; - t.is(computeCount, 1); + t.equal(computeCount, 1); obj.karkat; - t.is(computeCount, 1); + t.equal(computeCount, 1); obj.string = 'testing once again'; - t.is(computeCount, 1); + t.equal(computeCount, 1); obj.karkat; - t.is(computeCount, 2); + t.equal(computeCount, 2); obj.string = 'testing once again'; - t.is(computeCount, 2); + t.equal(computeCount, 2); obj.karkat; - t.is(computeCount, 2); + t.equal(computeCount, 2); }); -test(`CacheableObject combined update & expose (no transform)`, t => { +t.test(`CacheableObject combined update & expose (no transform)`, t => { const obj = newCacheableObject({ directory: { flags: { @@ -101,13 +97,13 @@ test(`CacheableObject combined update & expose (no transform)`, t => { t.plan(2); obj.directory = 'the-world-revolving'; - t.is(obj.directory, 'the-world-revolving'); + t.equal(obj.directory, 'the-world-revolving'); obj.directory = 'chaos-king'; - t.is(obj.directory, 'chaos-king'); + t.equal(obj.directory, 'chaos-king'); }); -test(`CacheableObject combined update & expose (basic transform)`, t => { +t.test(`CacheableObject combined update & expose (basic transform)`, t => { const obj = newCacheableObject({ getsRepeated: { flags: { @@ -124,10 +120,10 @@ test(`CacheableObject combined update & expose (basic transform)`, t => { t.plan(1); obj.getsRepeated = 'dog'; - t.is(obj.getsRepeated, 'dogdog'); + t.equal(obj.getsRepeated, 'dogdog'); }); -test(`CacheableObject combined update & expose (transform with dependency)`, t => { +t.test(`CacheableObject combined update & expose (transform with dependency)`, t => { const obj = newCacheableObject({ customRepeat: { flags: { @@ -152,16 +148,16 @@ test(`CacheableObject combined update & expose (transform with dependency)`, t = obj.customRepeat = 'dog'; obj.times = 1; - t.is(obj.customRepeat, 'dog'); + t.equal(obj.customRepeat, 'dog'); obj.times = 5; - t.is(obj.customRepeat, 'dogdogdogdogdog'); + t.equal(obj.customRepeat, 'dogdogdogdogdog'); obj.customRepeat = 'cat'; - t.is(obj.customRepeat, 'catcatcatcatcat'); + t.equal(obj.customRepeat, 'catcatcatcatcat'); }); -test(`CacheableObject validate on update`, t => { +t.test(`CacheableObject validate on update`, t => { const mockError = new TypeError(`Expected a string, not ${typeof value}`); const obj = newCacheableObject({ @@ -197,7 +193,7 @@ test(`CacheableObject validate on update`, t => { t.plan(6); obj.directory = 'megalovania'; - t.is(obj.directory, 'megalovania'); + t.equal(obj.directory, 'megalovania'); try { obj.directory = 25; @@ -205,13 +201,13 @@ test(`CacheableObject validate on update`, t => { thrownError = err; } - t.is(thrownError, mockError); - t.is(obj.directory, 'megalovania'); + t.equal(thrownError, mockError); + t.equal(obj.directory, 'megalovania'); const date = new Date(`25 December 2009`); obj.date = date; - t.is(obj.date, date); + t.equal(obj.date, date); try { obj.date = `TWELFTH PERIGEE'S EVE`; @@ -219,11 +215,11 @@ test(`CacheableObject validate on update`, t => { thrownError = err; } - t.is(thrownError?.constructor, TypeError); - t.is(obj.date, date); + t.equal(thrownError?.constructor, TypeError); + t.equal(obj.date, date); }); -test(`CacheableObject default update property value`, t => { +t.test(`CacheableObject default update property value`, t => { const obj = newCacheableObject({ fruit: { flags: { @@ -238,10 +234,10 @@ test(`CacheableObject default update property value`, t => { }); t.plan(1); - t.is(obj.fruit, 'potassium'); + t.equal(obj.fruit, 'potassium'); }); -test(`CacheableObject default property throws if invalid`, t => { +t.test(`CacheableObject default property throws if invalid`, t => { const mockError = new TypeError(`Expected a string, not ${typeof value}`); t.plan(1); @@ -270,5 +266,5 @@ test(`CacheableObject default property throws if invalid`, t => { thrownError = err; } - t.is(thrownError, mockError); + t.equal(thrownError, mockError); }); diff --git a/test/data-validators.js b/test/data-validators.js index 7a2b1812..44b74679 100644 --- a/test/data-validators.js +++ b/test/data-validators.js @@ -1,4 +1,4 @@ -import _test from 'tape'; +import t from 'tap'; import { showAggregate } from '../src/util/sugar.js'; import { @@ -26,8 +26,8 @@ import { oneOf, } from '../src/data/things/validators.js'; -function test(msg, fn) { - _test(msg, t => { +function test(t, msg, fn) { + t.test(msg, t => { try { fn(t); } catch (error) { @@ -39,11 +39,9 @@ function test(msg, fn) { }); } -test.skip = _test.skip; - // Basic types -test('isBoolean', t => { +test(t, 'isBoolean', t => { t.plan(4); t.ok(isBoolean(true)); t.ok(isBoolean(false)); @@ -51,7 +49,7 @@ test('isBoolean', t => { t.throws(() => isBoolean('yes'), TypeError); }); -test('isNumber', t => { +test(t, 'isNumber', t => { t.plan(6); t.ok(isNumber(123)); t.ok(isNumber(0.05)); @@ -61,7 +59,7 @@ test('isNumber', t => { t.throws(() => isNumber(true), TypeError); }); -test('isCountingNumber', t => { +test(t, 'isCountingNumber', t => { t.plan(6); t.ok(isCountingNumber(3)); t.ok(isCountingNumber(1)); @@ -71,14 +69,14 @@ test('isCountingNumber', t => { t.throws(() => isCountingNumber('612'), TypeError); }); -test('isString', t => { +test(t, 'isString', t => { t.plan(3); t.ok(isString('hello!')); t.ok(isString('')); t.throws(() => isString(100), TypeError); }); -test('isStringNonEmpty', t => { +test(t, 'isStringNonEmpty', t => { t.plan(4); t.ok(isStringNonEmpty('hello!')); t.throws(() => isStringNonEmpty(''), TypeError); @@ -88,25 +86,25 @@ test('isStringNonEmpty', t => { // Complex types -test('isArray', t => { +test(t, 'isArray', t => { t.plan(3); t.ok(isArray([])); t.throws(() => isArray({}), TypeError); t.throws(() => isArray('1, 2, 3'), TypeError); }); -test.skip('isDate', t => { +t.skip('isDate', t => { // TODO }); -test('isObject', t => { +test(t, 'isObject', t => { t.plan(3); t.ok(isObject({})); t.ok(isObject([])); t.throws(() => isObject(null), TypeError); }); -test('validateArrayItems', t => { +test(t, 'validateArrayItems', t => { t.plan(6); t.ok(validateArrayItems(isNumber)([3, 4, 5])); @@ -119,31 +117,31 @@ test('validateArrayItems', t => { caughtError = err; } - t.isNot(caughtError, null); - t.true(caughtError instanceof AggregateError); - t.is(caughtError.errors.length, 1); - t.true(caughtError.errors[0] instanceof TypeError); + t.not(caughtError, null); + t.ok(caughtError instanceof AggregateError); + t.equal(caughtError.errors.length, 1); + t.ok(caughtError.errors[0] instanceof TypeError); }); // Wiki data -test.skip('isColor', t => { +t.skip('isColor', t => { // TODO }); -test.skip('isCommentary', t => { +t.skip('isCommentary', t => { // TODO }); -test.skip('isContribution', t => { +t.skip('isContribution', t => { // TODO }); -test.skip('isContributionList', t => { +t.skip('isContributionList', t => { // TODO }); -test('isDimensions', t => { +test(t, 'isDimensions', t => { t.plan(6); t.ok(isDimensions([1, 1])); t.ok(isDimensions([50, 50])); @@ -153,7 +151,7 @@ test('isDimensions', t => { t.throws(() => isDimensions('800x200'), TypeError); }); -test('isDirectory', t => { +test(t, 'isDirectory', t => { t.plan(6); t.ok(isDirectory('savior-of-the-waking-world')); t.ok(isDirectory('MeGaLoVania')); @@ -163,7 +161,7 @@ test('isDirectory', t => { t.throws(() => isDirectory('troll saint nicholas and the quest for the holy pail'), TypeError); }); -test('isDuration', t => { +test(t, 'isDuration', t => { t.plan(5); t.ok(isDuration(60)); t.ok(isDuration(0.02)); @@ -172,7 +170,7 @@ test('isDuration', t => { t.throws(() => isDuration('10:25'), TypeError); }); -test('isFileExtension', t => { +test(t, 'isFileExtension', t => { t.plan(6); t.ok(isFileExtension('png')); t.ok(isFileExtension('jpg')); @@ -182,15 +180,15 @@ test('isFileExtension', t => { t.throws(() => isFileExtension('just an image bro!!!!'), TypeError); }); -test.skip('isName', t => { +t.skip('isName', t => { // TODO }); -test.skip('isURL', t => { +t.skip('isURL', t => { // TODO }); -test('validateReference', t => { +test(t, 'validateReference', t => { t.plan(16); const typeless = validateReference(); @@ -217,7 +215,7 @@ test('validateReference', t => { t.throws(() => typeless('album:undertale-soundtrack')); }); -test('validateReferenceList', t => { +test(t, 'validateReferenceList', t => { const track = validateReferenceList('track'); const artist = validateReferenceList('artist'); @@ -235,14 +233,14 @@ test('validateReferenceList', t => { caughtError = err; } - t.isNot(caughtError, null); - t.true(caughtError instanceof AggregateError); - t.is(caughtError.errors.length, 2); - t.true(caughtError.errors[0] instanceof TypeError); - t.true(caughtError.errors[1] instanceof TypeError); + t.not(caughtError, null); + t.ok(caughtError instanceof AggregateError); + t.equal(caughtError.errors.length, 2); + t.ok(caughtError.errors[0] instanceof TypeError); + t.ok(caughtError.errors[1] instanceof TypeError); }); -test('oneOf', t => { +test(t, 'oneOf', t => { t.plan(11); const isStringOrNumber = oneOf(isString, isNumber); @@ -267,11 +265,11 @@ test('oneOf', t => { caughtError = err; } - t.isNot(caughtError, null); - t.true(caughtError instanceof AggregateError); - t.is(caughtError.errors.length, 2); - t.true(caughtError.errors[0] instanceof TypeError); - t.is(caughtError.errors[0].check, isString); - t.is(caughtError.errors[1], mockError); - t.is(caughtError.errors[1].check, neverSucceeds); + t.not(caughtError, null); + t.ok(caughtError instanceof AggregateError); + t.equal(caughtError.errors.length, 2); + t.ok(caughtError.errors[0] instanceof TypeError); + t.equal(caughtError.errors[0].check, isString); + t.equal(caughtError.errors[1], mockError); + t.equal(caughtError.errors[1].check, neverSucceeds); }); diff --git a/test/html.js b/test/html.js index 25d6070d..6ca5a833 100644 --- a/test/html.js +++ b/test/html.js @@ -1,9 +1,9 @@ -import test from 'tape'; +import t from 'tap'; import * as html from '../src/util/html.js'; const {Tag, Attributes, Template, Slot} = html; -test(`html.tag`, t => { +t.test(`html.tag`, t => { t.plan(16); const tag1 = @@ -14,16 +14,16 @@ test(`html.tag`, t => { // 1-5: basic behavior when passing attributes t.ok(tag1 instanceof Tag); t.ok(tag1.onlyIfContent); - t.is(tag1.attributes.get('foo'), 'bar'); - t.is(tag1.content.length, 1); - t.is(tag1.content[0], 'child'); + t.equal(tag1.attributes.get('foo'), 'bar'); + t.equal(tag1.content.length, 1); + t.equal(tag1.content[0], 'child'); const tag2 = html.tag('div', ['two', 'children']); // 6-8: basic behavior when not passing attributes - t.is(tag2.content.length, 2); - t.is(tag2.content[0], 'two'); - t.is(tag2.content[1], 'children'); + t.equal(tag2.content.length, 2); + t.equal(tag2.content[0], 'two'); + t.equal(tag2.content[1], 'children'); const genericTag = html.tag('div'); let genericSlot; @@ -34,18 +34,18 @@ test(`html.tag`, t => { // 9-10: tag treated as content, not attributes const tag3 = html.tag('div', genericTag); - t.is(tag3.content.length, 1); - t.is(tag3.content[0], genericTag); + t.equal(tag3.content.length, 1); + t.equal(tag3.content[0], genericTag); // 11-12: template treated as content, not attributes const tag4 = html.tag('div', genericTemplate); - t.is(tag4.content.length, 1); - t.is(tag4.content[0], genericTemplate); + t.equal(tag4.content.length, 1); + t.equal(tag4.content[0], genericTemplate); // 13-14: slot treated as content, not attributes const tag5 = html.tag('div', genericSlot); - t.is(tag5.content.length, 1); - t.is(tag5.content[0], genericSlot); + t.equal(tag5.content.length, 1); + t.equal(tag5.content[0], genericSlot); // 15-16: deep flattening support const tag6 = @@ -56,34 +56,34 @@ test(`html.tag`, t => { [[[[[`That's deep.`]]]]], ]]]]]], ]); - t.is(tag6.content.length, 1); - t.is(tag6.content[0], `That's deep.`); + t.equal(tag6.content.length, 1); + t.equal(tag6.content[0], `That's deep.`); }); -test(`Tag (basic interface)`, t => { +t.test(`Tag (basic interface)`, t => { t.plan(11); const tag1 = new Tag(); // 1-5: essential properties & no arguments provided - t.is(tag1.tagName, ''); + t.equal(tag1.tagName, ''); t.ok(Array.isArray(tag1.content)); - t.is(tag1.content.length, 0); + t.equal(tag1.content.length, 0); t.ok(tag1.attributes instanceof Attributes); - t.is(tag1.attributes.toString(), ''); + t.equal(tag1.attributes.toString(), ''); const tag2 = new Tag('div', {id: 'banana'}, ['one', 'two', tag1]); // 6-11: properties on basic usage - t.is(tag2.tagName, 'div'); - t.is(tag2.content.length, 3); - t.is(tag2.content[0], 'one'); - t.is(tag2.content[1], 'two'); - t.is(tag2.content[2], tag1); - t.is(tag2.attributes.get('id'), 'banana'); + t.equal(tag2.tagName, 'div'); + t.equal(tag2.content.length, 3); + t.equal(tag2.content[0], 'one'); + t.equal(tag2.content[1], 'two'); + t.equal(tag2.content[2], tag1); + t.equal(tag2.attributes.get('id'), 'banana'); }); -test(`Tag (self-closing)`, t => { +t.test(`Tag (self-closing)`, t => { t.plan(10); const tag1 = new Tag('br'); @@ -114,7 +114,7 @@ test(`Tag (self-closing)`, t => { t.throws(() => { tag4.tagName = 'br'; }, /self-closing/); }); -test(`Tag (properties from attributes - from constructor)`, t => { +t.test(`Tag (properties from attributes - from constructor)`, t => { t.plan(6); const tag = new Tag('div', { @@ -126,15 +126,15 @@ test(`Tag (properties from attributes - from constructor)`, t => { // 1-3: basic exposed properties from attributes in constructor t.ok(tag.onlyIfContent); t.ok(tag.noEdgeWhitespace); - t.is(tag.joinChildren, '<br>'); + t.equal(tag.joinChildren, '<br>'); // 4-6: property values stored on attributes with public symbols - t.is(tag.attributes.get(html.onlyIfContent), true); - t.is(tag.attributes.get(html.noEdgeWhitespace), true); - t.is(tag.attributes.get(html.joinChildren), '<br>'); + t.equal(tag.attributes.get(html.onlyIfContent), true); + t.equal(tag.attributes.get(html.noEdgeWhitespace), true); + t.equal(tag.attributes.get(html.joinChildren), '<br>'); }); -test(`Tag (properties from attributes - mutating)`, t => { +t.test(`Tag (properties from attributes - mutating)`, t => { t.plan(12); // 1-3: exposed properties reflect reasonable attribute values @@ -149,9 +149,9 @@ test(`Tag (properties from attributes - mutating)`, t => { tag1.attributes.remove(html.noEdgeWhitespace); tag1.attributes.set(html.joinChildren, '🍇'); - t.is(tag1.onlyIfContent, false); - t.is(tag1.noEdgeWhitespace, false); - t.is(tag1.joinChildren, '🍇'); + t.equal(tag1.onlyIfContent, false); + t.equal(tag1.noEdgeWhitespace, false); + t.equal(tag1.joinChildren, '🍇'); // 4-6: exposed properties reflect unreasonable attribute values @@ -165,9 +165,9 @@ test(`Tag (properties from attributes - mutating)`, t => { tag2.attributes.set(html.noEdgeWhitespace, 12345); tag2.attributes.set(html.joinChildren, 0.0001); - t.is(tag2.onlyIfContent, false); - t.is(tag2.noEdgeWhitespace, true); - t.is(tag2.joinChildren, '0.0001'); + t.equal(tag2.onlyIfContent, false); + t.equal(tag2.noEdgeWhitespace, true); + t.equal(tag2.joinChildren, '0.0001'); // 7-9: attribute values reflect reasonable mutated properties @@ -181,9 +181,9 @@ test(`Tag (properties from attributes - mutating)`, t => { tag3.noEdgeWhitespace = false; tag3.joinChildren = '🦑'; - t.is(tag3.attributes.get(html.onlyIfContent), true); - t.is(tag3.attributes.get(html.noEdgeWhitespace), undefined); - t.is(tag3.joinChildren, '🦑'); + t.equal(tag3.attributes.get(html.onlyIfContent), true); + t.equal(tag3.attributes.get(html.noEdgeWhitespace), undefined); + t.equal(tag3.joinChildren, '🦑'); // 10-12: attribute values reflect unreasonable mutated properties @@ -197,12 +197,12 @@ test(`Tag (properties from attributes - mutating)`, t => { tag4.noEdgeWhitespace = 0; tag4.joinChildren = Infinity; - t.is(tag4.attributes.get(html.onlyIfContent), true); - t.is(tag4.attributes.get(html.noEdgeWhitespace), undefined); - t.is(tag4.attributes.get(html.joinChildren), 'Infinity'); + t.equal(tag4.attributes.get(html.onlyIfContent), true); + t.equal(tag4.attributes.get(html.noEdgeWhitespace), undefined); + t.equal(tag4.attributes.get(html.joinChildren), 'Infinity'); }); -test(`Tag.toString`, t => { +t.test(`Tag.toString`, t => { t.plan(9); // 1: basic behavior @@ -210,7 +210,7 @@ test(`Tag.toString`, t => { const tag1 = html.tag('div', 'Content'); - t.is(tag1.toString(), + t.equal(tag1.toString(), `<div>Content</div>`); // 2: stringifies nested element @@ -218,7 +218,7 @@ test(`Tag.toString`, t => { const tag2 = html.tag('div', html.tag('p', 'Content')); - t.is(tag2.toString(), + t.equal(tag2.toString(), `<div><p>Content</p></div>`); // 3: stringifies attributes @@ -235,7 +235,7 @@ test(`Tag.toString`, t => { }, 'Content'); - t.is(tag3.toString(), + t.equal(tag3.toString(), `<div id="banana" class="foo bar" contenteditable ` + `saying=""To light a candle is to cast a shadow..."" ` + `tabindex="413">Content</div>`); @@ -247,7 +247,7 @@ test(`Tag.toString`, t => { {class: ['foo', 'bar'], id: 'banana'}, 'Content'); - t.is(tag4.toString(), + t.equal(tag4.toString(), `<div class="foo bar" id="banana">Content</div>`); // 5: multiline contented indented @@ -255,7 +255,7 @@ test(`Tag.toString`, t => { const tag5 = html.tag('div', 'foo\nbar'); - t.is(tag5.toString(), + t.equal(tag5.toString(), `<div>\n` + ` foo\n` + ` bar\n` + @@ -270,7 +270,7 @@ test(`Tag.toString`, t => { html.tag('span', `I'm on one line!`), ]); - t.is(tag6.toString(), + t.equal(tag6.toString(), `<div>\n` + ` <p>\n` + ` foo\n` + @@ -288,7 +288,7 @@ test(`Tag.toString`, t => { html.tag('p', `Shenanigans!`), ]); - t.is(tag7.toString(), + t.equal(tag7.toString(), `<article>\n` + ` <h1>Title</h1>\n` + ` <hr style="color: magenta">\n` + @@ -303,7 +303,7 @@ test(`Tag.toString`, t => { html.tag(`h2`, `Bar`), ]); - t.is(tag8.toString(), + t.equal(tag8.toString(), `<h1>Foo</h1>\n` + `<h2>Bar</h2>`); @@ -315,13 +315,13 @@ test(`Tag.toString`, t => { `Supercalifragilisticexpialidocious!` ]); - t.is(tag9.toString(), + t.equal(tag9.toString(), `Say it with me...\n` + `<br>\n` + `Supercalifragilisticexpialidocious!`); }); -test(`Tag.toString (onlyIfContent)`, t => { +t.test(`Tag.toString (onlyIfContent)`, t => { t.plan(4); // 1-2: basic behavior @@ -331,7 +331,7 @@ test(`Tag.toString (onlyIfContent)`, t => { {[html.onlyIfContent]: true}, `Hello!`); - t.is(tag1.toString(), + t.equal(tag1.toString(), `<div>Hello!</div>`); const tag2 = @@ -339,7 +339,7 @@ test(`Tag.toString (onlyIfContent)`, t => { {[html.onlyIfContent]: true}, ''); - t.is(tag2.toString(), + t.equal(tag2.toString(), ''); // 3-4: nested onlyIfContent with "more" content @@ -358,7 +358,7 @@ test(`Tag.toString (onlyIfContent)`, t => { false, ]); - t.is(tag3.toString(), + t.equal(tag3.toString(), ''); const tag4 = @@ -374,11 +374,11 @@ test(`Tag.toString (onlyIfContent)`, t => { false, ]); - t.is(tag4.toString(), + t.equal(tag4.toString(), `<div><h1><strong></strong></h1></div>`); }); -test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { +t.test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { t.plan(6); // 1: joinChildren: default (\n), noEdgeWhitespace: true @@ -392,7 +392,7 @@ test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { 'Baz', ]); - t.is(tag1.toString(), + t.equal(tag1.toString(), `<div>Foo\n` + ` Bar\n` + ` Baz</div>`); @@ -411,7 +411,7 @@ test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { 'Baz', ]); - t.is(tag2.toString(), + t.equal(tag2.toString(), `<div>\n` + ` Foo\n` + ` <br location="🍍">\n` + @@ -431,7 +431,7 @@ test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { 'Baz', ]); - t.is(tag3.toString(), + t.equal(tag3.toString(), `<div>FooBarBaz</div>`); const tag4 = @@ -442,7 +442,7 @@ test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { `~` ]); - t.is(tag4.toString(), + t.equal(tag4.toString(), `<div>\n` + ` Ain't I\n` + ` a cute one?~\n` + @@ -462,7 +462,7 @@ test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { 'Baz', ]); - t.is(tag5.toString(), + t.equal(tag5.toString(), `<div>Foo\n` + ` <br>\n` + ` Bar\n` + @@ -483,20 +483,20 @@ test(`Tag.toString (joinChildren, noEdgeWhitespace)`, t => { html.tag('sup', `💕`), ]); - t.is(tag6.toString(), + t.equal(tag6.toString(), `<span><i>Oh yes~ </i>You're a cute one<sup>💕</sup></span>`); }); -test(`Tag.toString (custom attributes)`, t => { +t.test(`Tag.toString (custom attributes)`, t => { t.plan(1); t.test(`Tag.toString (custom attribute: href)`, t => { t.plan(2); const tag1 = html.tag('a', {href: `https://hsmusic.wiki/`}); - t.is(tag1.toString(), `<a href="https://hsmusic.wiki/"></a>`); + t.equal(tag1.toString(), `<a href="https://hsmusic.wiki/"></a>`); const tag2 = html.tag('a', {href: `https://hsmusic.wiki/media/Album Booklet.pdf`}); - t.is(tag2.toString(), `<a href="https://hsmusic.wiki/media/Album%20Booklet.pdf"></a>`); + t.equal(tag2.toString(), `<a href="https://hsmusic.wiki/media/Album%20Booklet.pdf"></a>`); }); }); diff --git a/test/things.js b/test/things.js index fe6e33e0..df3a9f64 100644 --- a/test/things.js +++ b/test/things.js @@ -1,4 +1,4 @@ -import test from 'tape'; +import t from 'tap'; import thingConstructors from '../src/data/things/index.js'; @@ -20,7 +20,7 @@ function stubAlbum(tracks) { return album; } -test(`Track.coverArtDate`, t => { +t.test(`Track.coverArtDate`, t => { t.plan(5); // Priority order is as follows, with the last (trackCoverArtDate) being @@ -39,7 +39,7 @@ test(`Track.coverArtDate`, t => { // 1. coverArtDate defaults to null - t.is(track.coverArtDate, null); + t.equal(track.coverArtDate, null); // 2. coverArtDate inherits album release date @@ -49,7 +49,7 @@ test(`Track.coverArtDate`, t => { track.albumData = []; track.albumData = [album]; - t.is(track.coverArtDate, albumDate); + t.equal(track.coverArtDate, albumDate); // 3. coverArtDate inherits album trackArtDate @@ -59,17 +59,17 @@ test(`Track.coverArtDate`, t => { track.albumData = []; track.albumData = [album]; - t.is(track.coverArtDate, albumTrackArtDate); + t.equal(track.coverArtDate, albumTrackArtDate); // 4. coverArtDate is overridden dateFirstReleased track.dateFirstReleased = trackDateFirstReleased; - t.is(track.coverArtDate, trackDateFirstReleased); + t.equal(track.coverArtDate, trackDateFirstReleased); // 5. coverArtDate is overridden coverArtDate track.coverArtDate = trackCoverArtDate; - t.is(track.coverArtDate, trackCoverArtDate); + t.equal(track.coverArtDate, trackCoverArtDate); }); |