- Testing: Use more precise/semantic chai assertion methods

master
Brett Zamir 2020-02-27 07:25:58 +08:00
parent 9fac8ecc58
commit 8096f0750f
2 changed files with 5 additions and 5 deletions

View File

@ -129,7 +129,7 @@ describe('Basic Module', function () {
fu = document.getElementById('foreign-use'),
nfu = document.getElementById('no-use');
assert.equal((u && u.nodeName === 'use'), true, 'Did not import <use> element');
assert.equal((u && u.nodeName), 'use', 'Did not import <use> element');
assert.equal(fu, null, 'Removed <use> element that had a foreign href');
assert.equal(nfu, null, 'Removed <use> element that had no href');
});
@ -145,7 +145,7 @@ describe('Basic Module', function () {
const t = document.getElementById('the-text');
assert.equal((t && t.nodeName === 'text'), true, 'Did not import <text> element');
assert.equal((t && t.nodeName), 'text', 'Did not import <text> element');
assert.equal(t.getAttribute('d'), null, 'Imported a <text> with a d attribute');
});
@ -159,7 +159,7 @@ describe('Basic Module', function () {
);
const attrVal = document.getElementById('se_test_elem').getAttributeNS('http://svg-edit.googlecode.com', 'foo');
assert.equal(attrVal === 'bar', true, 'Preserved namespaced attribute on import');
assert.strictEqual(attrVal, 'bar', true, 'Preserved namespaced attribute on import');
const output = svgCanvas.getSvgString();
// } catch(e) {console.log(e)}

View File

@ -207,7 +207,7 @@ describe('utilities performance', function () {
}
total = lastTime - start;
const ave = total / count;
assert.ok(ave < 20, 'svgedit.utilities.getStrokedBBox average execution time is less than 20 ms');
assert.isBelow(ave, 20, 'svgedit.utilities.getStrokedBBox average execution time is less than 20 ms');
console.log('Pass1 svgCanvas.getStrokedBBox total ms ' + total + ', ave ms ' + ave.toFixed(1) + ',\t min/max ' + min + ' ' + max);
// eslint-disable-next-line promise/avoid-new
@ -229,7 +229,7 @@ describe('utilities performance', function () {
total = lastTime - strt;
const avg = total / ct;
assert.ok(avg < 2, 'svgedit.utilities.getStrokedBBox average execution time is less than 1 ms');
assert.isBelow(avg, 2, 'svgedit.utilities.getStrokedBBox average execution time is less than 1 ms');
console.log('Pass2 svgCanvas.getStrokedBBox total ms ' + total + ', ave ms ' + avg.toFixed(1) + ',\t min/max ' + min + ' ' + max);
resolve();