MCPcopy Index your code
hub / github.com/angular-fullstack/generator-angular-fullstack / assertOnlyFiles

Function assertOnlyFiles

src/test/test-helpers.js:55–71  ·  view source on GitHub ↗
(expectedFiles, topLevelPath='./', skip=['node_modules', 'bower_components'])

Source from the content-addressed store, hash-verified

53 * @returns {Promise}
54 */
55export function assertOnlyFiles(expectedFiles, topLevelPath='./', skip=['node_modules', 'bower_components']) {
56 return new Promise((resolve, reject) => {
57 recursiveReadDir(topLevelPath, skip, function(err, actualFiles) {
58 if(err) return reject(err);
59
60 actualFiles = _.map(actualFiles.concat(), file => path.normalize(file.replace(path.normalize(`${topLevelPath}/`), '')));
61 expectedFiles = _.map(expectedFiles, file => path.normalize(file));
62
63 let extras = _.pullAll(actualFiles, expectedFiles);
64
65 if(extras.length !== 0) {
66 return reject(extras);
67 }
68 resolve();
69 });
70 });
71}
72
73/**
74 * Read JSON from a file

Callers 1

main.test.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected