mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Fixed exporter tests using should.have.keys assertion
refs https://github.com/TryGhost/Team/issues/555
refs 080a8fc082
- The `have.keys` assertion was not doing strict comparison neither provided any useful output when changed to `have.only.keys`.
- Rewrote the tests to use manual assertion through array comparison which checks exactly what it's supposed to and gives a visual diff in case there are any missing/extra properties in config
This commit is contained in:
parent
080a8fc082
commit
74cdbadedb
@ -51,9 +51,9 @@ describe('DB API', function () {
|
||||
|
||||
const dataKeys = Object.keys(exportedBodyLatest().db[0].data);
|
||||
|
||||
Object.keys(jsonResponse.db[0].data).length.should.eql(28);
|
||||
Object.keys(jsonResponse.db[0].data).length.should.eql(dataKeys.length);
|
||||
jsonResponse.db[0].data.should.have.only.keys(...dataKeys);
|
||||
// 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);
|
||||
});
|
||||
|
||||
it('Can delete all content', async function () {
|
||||
|
@ -66,8 +66,10 @@ describe('Exporter', function () {
|
||||
should.exist(exportData.meta);
|
||||
should.exist(exportData.data);
|
||||
|
||||
exportData.data.should.have.only.keys(...tables);
|
||||
exportData.data.should.have.keys(...Object.keys(exportedBodyLatest().db[0].data));
|
||||
// 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));
|
||||
exportData.meta.version.should.equal(ghostVersion.full);
|
||||
|
||||
// excludes table should contain no data
|
||||
|
Loading…
Reference in New Issue
Block a user