Fixed a test failing due to a .DS_Store file

no refs

- When a `.DS_Store` file was present, the code wasn't ignoring the `README.md` anymore. I've fixed it with a for+while nested loops.
This commit is contained in:
Thibaut Patel 2021-12-01 15:28:28 +01:00
parent a1421c2380
commit e17446456e

View File

@ -162,11 +162,11 @@ describe('Themes API', function () {
// ensure tmp theme folder contains one theme again now
const tmpFolderContents = fs.readdirSync(config.getContentPath('themes'));
tmpFolderContents.forEach((theme, index) => {
if (theme.match(/^\./) || theme === 'README.md') {
tmpFolderContents.splice(index, 1);
for (let i = 0; i < tmpFolderContents.length; i++) {
while (tmpFolderContents[i].match(/^\./) || tmpFolderContents[i] === 'README.md') {
tmpFolderContents.splice(i, 1);
}
});
}
tmpFolderContents.should.be.an.Array().with.lengthOf(10);
tmpFolderContents.should.eql([