- Testing: Use more precise/semantic chai assertion methods
This commit is contained in:
@@ -129,7 +129,7 @@ describe('Basic Module', function () {
|
|||||||
fu = document.getElementById('foreign-use'),
|
fu = document.getElementById('foreign-use'),
|
||||||
nfu = document.getElementById('no-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(fu, null, 'Removed <use> element that had a foreign href');
|
||||||
assert.equal(nfu, null, 'Removed <use> element that had no 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');
|
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');
|
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');
|
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();
|
const output = svgCanvas.getSvgString();
|
||||||
// } catch(e) {console.log(e)}
|
// } catch(e) {console.log(e)}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ describe('utilities performance', function () {
|
|||||||
}
|
}
|
||||||
total = lastTime - start;
|
total = lastTime - start;
|
||||||
const ave = total / count;
|
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);
|
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
|
// eslint-disable-next-line promise/avoid-new
|
||||||
@@ -229,7 +229,7 @@ describe('utilities performance', function () {
|
|||||||
|
|
||||||
total = lastTime - strt;
|
total = lastTime - strt;
|
||||||
const avg = total / ct;
|
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);
|
console.log('Pass2 svgCanvas.getStrokedBBox total ms ' + total + ', ave ms ' + avg.toFixed(1) + ',\t min/max ' + min + ' ' + max);
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
Reference in New Issue
Block a user