mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
tests: Use assert.deepEqual()
to simplify equality checks
This commit is contained in:
parent
dd815892f2
commit
fc69ae78aa
1 changed files with 3 additions and 18 deletions
|
@ -10,6 +10,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const AttributePool = require('ep_etherpad-lite/static/js/AttributePool');
|
const AttributePool = require('ep_etherpad-lite/static/js/AttributePool');
|
||||||
|
const assert = require('assert').strict;
|
||||||
const cheerio = require('ep_etherpad-lite/node_modules/cheerio');
|
const cheerio = require('ep_etherpad-lite/node_modules/cheerio');
|
||||||
const contentcollector = require('ep_etherpad-lite/static/js/contentcollector');
|
const contentcollector = require('ep_etherpad-lite/static/js/contentcollector');
|
||||||
|
|
||||||
|
@ -298,24 +299,8 @@ describe(__filename, function () {
|
||||||
const recievedText = new Array(result.lines);
|
const recievedText = new Array(result.lines);
|
||||||
const expectedText = testObj.expectedText;
|
const expectedText = testObj.expectedText;
|
||||||
|
|
||||||
// Check recieved text matches the expected text
|
assert.deepEqual(recievedText[0], expectedText);
|
||||||
if (arraysEqual(recievedText[0], expectedText)) {
|
assert.deepEqual(recievedAttributes, expectedAttributes);
|
||||||
// console.log("PASS: Recieved Text did match Expected Text\nRecieved:", recievedText[0], "\nExpected:", testObj.expectedText)
|
|
||||||
} else {
|
|
||||||
console.error('FAIL: Recieved Text did not match Expected Text\nRecieved:', recievedText[0], '\nExpected:', testObj.expectedText);
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check recieved attributes matches the expected attributes
|
|
||||||
if (arraysEqual(recievedAttributes, expectedAttributes)) {
|
|
||||||
// console.log("PASS: Recieved Attributes matched Expected Attributes");
|
|
||||||
done();
|
|
||||||
} else {
|
|
||||||
console.error('FAIL', test, testObj.description);
|
|
||||||
console.error('FAIL: Recieved Attributes did not match Expected Attributes\nRecieved: ', recievedAttributes, '\nExpected: ', expectedAttributes);
|
|
||||||
console.error('FAILING HTML', testObj.html);
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue