Fixed node version specific object key sorting (#12817)

refs 74cdbadedb

- Fixes failing test by enforcing ordering through `sort()` call. Doing this to avoid differences between node versions' `Object.keys()` ordering
This commit is contained in:
naz 2021-03-25 15:16:24 +13:00 committed by GitHub
parent 74cdbadedb
commit 7f50083cc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -49,11 +49,11 @@ describe('DB API', function () {
should.exist(jsonResponse.db);
jsonResponse.db.should.have.length(1);
const dataKeys = Object.keys(exportedBodyLatest().db[0].data);
const dataKeys = Object.keys(exportedBodyLatest().db[0].data).sort();
// NOTE: using `Object.keys` here instead of `should.have.only.keys` assertion
// because when `have.only.keys` fails there's no useful diff
Object.keys(jsonResponse.db[0].data).should.eql(dataKeys);
Object.keys(jsonResponse.db[0].data).sort().should.be.eql(dataKeys);
});
it('Can delete all content', async function () {

View File

@ -68,8 +68,8 @@ describe('Exporter', function () {
// NOTE: using `Object.keys` here instead of `should.have.only.keys` assertion
// because when `have.only.keys` fails there's no useful diff
Object.keys(exportData.data).should.eql(tables);
Object.keys(exportData.data).should.containDeep(Object.keys(exportedBodyLatest().db[0].data));
Object.keys(exportData.data).sort().should.eql(tables.sort());
Object.keys(exportData.data).sort().should.containDeep(Object.keys(exportedBodyLatest().db[0].data));
exportData.meta.version.should.equal(ghostVersion.full);
// excludes table should contain no data