Fixed config test that failed to detect changes

no issue

- The test was designed to fail when `exactly the right keys` were modified. This was not happening! The `have.keys` assertion was not doing strict comparison neither provided any useful output when changed to `have.only.keys`.
- Rewrote the test 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:
Naz 2021-03-25 13:12:43 +13:00
parent eb2b98a087
commit 080a8fc082

View File

@ -90,16 +90,23 @@ describe('Config', function () {
const pathConfig = configUtils.config.get('paths');
// This will fail if there are any extra keys
pathConfig.should.have.keys(
'appRoot',
'internalAdaptersPath',
// NOTE: using `Object.keys` here instead of `should.have.keys` assertion
// because when `have.keys` fails there's no useful diff
// and it doesn't make sure to check for "extra" keys
Object.keys(pathConfig).should.eql([
'contentPath',
'appRoot',
'corePath',
'internalAppPath',
'adminViews',
'clientAssets',
'helperTemplates',
'clientAssets'
);
'adminViews',
'defaultViews',
'defaultSettings',
'internalAppPath',
'internalAdaptersPath',
'migrationPath',
'publicFilePath'
]);
});
it('should have the correct values for each key', function () {