fix Tests not passing on Windows

This commit is contained in:
Doug Moscrop 2016-09-24 11:21:19 -04:00
parent d17801d39c
commit 4490af73c0
2 changed files with 14 additions and 7 deletions

View File

@ -2,6 +2,7 @@
const expect = require('chai').expect;
const fs = require('fs');
const os = require('os');
const path = require('path');
const JsZip = require('jszip');
const _ = require('lodash');
@ -140,13 +141,19 @@ describe('#zipService()', () => {
}).then(unzippedData => {
const unzippedFileData = unzippedData.files;
// binary file is set with chmod of 777
expect(unzippedFileData['bin/some-binary'].unixPermissions)
.to.equal(Math.pow(2, 15) + 777);
if (os.platform() === 'win32') {
// chmod does not work right on windows. this is better than nothing?
expect(unzippedFileData['bin/some-binary'].unixPermissions)
.to.not.equal(unzippedFileData['bin/read-only'].unixPermissions);
} else {
// binary file is set with chmod of 777
expect(unzippedFileData['bin/some-binary'].unixPermissions)
.to.equal(Math.pow(2, 15) + 777);
// read only file is set with chmod of 444
expect(unzippedFileData['bin/read-only'].unixPermissions)
.to.equal(Math.pow(2, 15) + 444);
// read only file is set with chmod of 444
expect(unzippedFileData['bin/read-only'].unixPermissions)
.to.equal(Math.pow(2, 15) + 444);
}
});
});

View File

@ -135,7 +135,7 @@ describe('Utils', () => {
expect(() => {
serverless.utils.readFileSync(tmpFilePath);
}).to.throw(new RegExp(`in "${tmpFilePath}"`));
}).to.throw(new RegExp('YAMLException:.*invalid.yml'));
});
});