Skip to content

Commit

Permalink
Fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
devconcept committed Jul 9, 2019
1 parent 3eee3ea commit a8dc67f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"extends": "eslint:recommended",
"rules": {
"strict": "error",
"strict": "off",
"callback-return": "warn",
"global-require": "error",
"new-cap": "warn",
Expand Down
12 changes: 6 additions & 6 deletions test/errors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Error handling', () => {
it('should fail gracefully if an error is thrown inside the configuration function', function (done) {
this.slow(200);
let error;
storage = GridFsStorage({
storage = new GridFsStorage({
url: settings.mongoUrl,
file: () => {
throw new Error('Error thrown');
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('Error handling', () => {
it('should fail gracefully if an error is thrown inside a generator function', function (done) {
let error;

storage = GridFsStorage({
storage = new GridFsStorage({
url: settings.mongoUrl,
file: function* () { // eslint-disable-line require-yield
throw new Error('File error');
Expand Down Expand Up @@ -147,7 +147,7 @@ describe('Error handling', () => {
setTimeout(() => reject(error), 200);
});

storage = GridFsStorage({db: promise});
storage = new GridFsStorage({db: promise});

const upload = multer({storage});

Expand Down Expand Up @@ -190,7 +190,7 @@ describe('Error handling', () => {
return db.close().then(() => db);
})
.then(db => {
storage = GridFsStorage({db});
storage = new GridFsStorage({db});
const upload = multer({storage});

app.post('/close', upload.array('photos', 2), (err, req, res, next) => {
Expand Down Expand Up @@ -230,7 +230,7 @@ describe('Error handling', () => {
it('should throw an error if the mongodb connection fails', function (done) {
const connectionSpy = sinon.spy();

storage = GridFsStorage({
storage = new GridFsStorage({
url: settings.mongoUrl,
});

Expand Down Expand Up @@ -262,7 +262,7 @@ describe('Error handling', () => {
throw generatedError;
});

storage = GridFsStorage({
storage = new GridFsStorage({
url: settings.mongoUrl,
});

Expand Down
8 changes: 4 additions & 4 deletions test/generators.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ describe('ES6 generators', () => {
before((done) => {
parameters = [];

storage = GridFsStorage({
storage = new GridFsStorage({
url: setting.mongoUrl,
file: function* (req, file) {
let counter = 0;
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('ES6 generators', () => {
describe('promises and generators', () => {
let result;
before((done) => {
storage = GridFsStorage({
storage = new GridFsStorage({
url: setting.mongoUrl,
file: function* () {
let counter = 0;
Expand Down Expand Up @@ -240,7 +240,7 @@ describe('ES6 generators', () => {
describe('finite generators', () => {
let error;
before((done) => {
storage = GridFsStorage({
storage = new GridFsStorage({
url: setting.mongoUrl,
file: function* () {
yield {
Expand Down Expand Up @@ -291,7 +291,7 @@ describe('ES6 generators', () => {
describe('rejected promise', () => {
let error;
before((done) => {
storage = GridFsStorage({
storage = new GridFsStorage({
url: setting.mongoUrl,
file: function* () {
yield Promise.reject('reason');
Expand Down
10 changes: 5 additions & 5 deletions test/legacy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ describe('Backwards compatibility', () => {
},
}),
});
storage = GridFsStorage({url: setting.mongoUrl});
storage = new GridFsStorage({url: setting.mongoUrl});
storage._legacy = true;
storage.on('streamError', errorSpy);
storage.on('file', fileSpy);
Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Backwards compatibility', () => {
before((done) => {
emitterStub = sinon.stub().callsFake((evt, cb) => {
if (evt === 'end') {
cb();
return cb();
}
});
sinon.stub(mongo, 'GridStore').returns({
Expand All @@ -292,7 +292,7 @@ describe('Backwards compatibility', () => {
},
}),
});
storage = GridFsStorage({url: setting.mongoUrl});
storage = new GridFsStorage({url: setting.mongoUrl});
storage._legacy = true;
storage.on('streamError', errorSpy);
storage.on('file', fileSpy);
Expand Down Expand Up @@ -342,7 +342,7 @@ describe('Backwards compatibility', () => {
}
return Promise.resolve(db);
});
storage = GridFsStorage({url: setting.mongoUrl});
storage = new GridFsStorage({url: setting.mongoUrl});

storage.on('connection', (db, client) => {
expect(db).to.be.an.instanceOf(mongo.Db);
Expand All @@ -364,7 +364,7 @@ describe('Backwards compatibility', () => {
}
return Promise.resolve(client);
});
storage = GridFsStorage({url: setting.mongoUrl});
storage = new GridFsStorage({url: setting.mongoUrl});

storage.on('connection', (db, client) => {
expect(mongoSpy).to.have.callCount(1);
Expand Down
2 changes: 1 addition & 1 deletion test/storage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ describe('Storage', () => {
},
});

storage2 = GridFsStorage({
storage2 = new GridFsStorage({
url: settings.mongoUrl,
connectionOpts: {
poolSize: 10,
Expand Down

0 comments on commit a8dc67f

Please sign in to comment.