This commit is contained in:
Abhinav Adduri 2017-06-23 11:42:51 -07:00
parent 2b4df1cd51
commit 525c15124a
4 changed files with 25 additions and 5 deletions

14
package-lock.json generated
View File

@ -2464,6 +2464,12 @@
"integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=",
"dev": true
},
"is-utf8": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true
},
"is-windows": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.1.tgz",
@ -2875,7 +2881,7 @@
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
"integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM="
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA=="
},
"minimist": {
"version": "0.0.10",
@ -4329,6 +4335,12 @@
}
}
},
"uglify-to-browserify": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
"integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
"optional": true
},
"umd": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/umd/-/umd-3.0.1.tgz",

View File

@ -44,7 +44,7 @@ conf.validate({ allowed: 'strict' });
const props = conf.getProperties();
module.exports = props;
console.log(props.sentry_dsn)
module.exports.notLocalHost =
props.env === 'production' &&
props.s3_bucket !== 'localhost' &&

View File

@ -58,7 +58,11 @@ function filename(id) {
function exists(id) {
return new Promise((resolve, reject) => {
redis_client.exists(id, (rediserr, reply) => {
reply === 1 && !rediserr ? resolve() : reject(rediserr);;
if (reply === 1 && !rediserr) {
resolve();
} else {
reject(rediserr);
}
});
});
}

View File

@ -44,12 +44,16 @@ const storage = proxyquire('../server/storage', {
describe('Testing Exists from local filesystem', function() {
it('Exists returns true when file exists', function() {
exists.callsArgWith(1, null, 1);
return storage.exists('test').then(reply => assert(reply));
return storage.exists('test')
.then(() => assert(1))
.catch(err => assert.fail())
});
it('Exists returns false when file does not exist', function() {
exists.callsArgWith(1, null, 0);
return storage.exists('test').then(reply => assert(!reply));
return storage.exists('test')
.then(() => assert.fail())
.catch(err => assert(1))
});
});