Browse Source

fix extra error when no slug dir found

pull/128/head
Jeremy Wentworth 7 years ago
parent
commit
fff908e68c
1 changed files with 8 additions and 6 deletions
  1. +8
    -6
      spec/manifest.tests.spec.js

+ 8
- 6
spec/manifest.tests.spec.js View File

@@ -110,14 +110,16 @@ function testOneZip(expectedRootDir, osObj, done) {
const slugDirFound = zipEntries.find(ze => ze.isDirectory &&
(ze.entryName === expectedRootDir+'/' || ze.entryName === expectedRootDir+'\\')
);
if(!slugDirFound){
fail(`Zip should have one dir named ${expectedRootDir}`);
if(slugDirFound){
const invalidEntry = zipEntries.find(ze => !ze.entryName.startsWith(slugDirFound.entryName));
if(invalidEntry){
fail(`Zip entries should all be under a dir named ${expectedRootDir} but this entry was found: ${invalidEntry.entryName}`);
}
} else {
fail(`Zip should have one dir named ${expectedRootDir}`);
}

const invalidEntry = zipEntries.find(ze => !ze.entryName.startsWith(slugDirFound.entryName));
if(invalidEntry){
fail(`Zip entries should all be under a dir named ${expectedRootDir} but this entry was found: ${invalidEntry.entryName}`);
}

if(VIRUS_TOTAL_ENABLED){
con.FileEvaluation(zipName, "application/zip", fs.readFileSync(TEMP_DIR+zipName), function(data) {


Loading…
Cancel
Save