Fix eslint errors
This commit is contained in:
@@ -25,16 +25,16 @@ describe('Mongo Integration Tests', function() {
|
||||
|
||||
describe("create", () => {
|
||||
it('should insert a document', function *() {
|
||||
let r = yield mongo.create({ _id:'0' }, DB_TYPE);
|
||||
const r = yield mongo.create({_id: '0'}, DB_TYPE);
|
||||
expect(r.insertedCount).to.equal(1);
|
||||
});
|
||||
|
||||
it('should fail if two with the same ID are inserted', function *() {
|
||||
let r = yield mongo.create({ _id:'0' }, DB_TYPE);
|
||||
let r = yield mongo.create({_id: '0'}, DB_TYPE);
|
||||
expect(r.insertedCount).to.equal(1);
|
||||
try {
|
||||
r = yield mongo.create({ _id:'0' }, DB_TYPE);
|
||||
} catch(e) {
|
||||
r = yield mongo.create({_id: '0'}, DB_TYPE);
|
||||
} catch (e) {
|
||||
expect(e.message).to.match(/duplicate/);
|
||||
}
|
||||
});
|
||||
@@ -42,16 +42,16 @@ describe('Mongo Integration Tests', function() {
|
||||
|
||||
describe("batch", () => {
|
||||
it('should insert a document', function *() {
|
||||
let r = yield mongo.batch([{ _id:'0' }, { _id:'1' }], DB_TYPE);
|
||||
const r = yield mongo.batch([{_id: '0'}, {_id: '1'}], DB_TYPE);
|
||||
expect(r.insertedCount).to.equal(2);
|
||||
});
|
||||
|
||||
it('should fail if docs with the same ID are inserted', function *() {
|
||||
let r = yield mongo.batch([{ _id:'0' }, { _id:'1' }], DB_TYPE);
|
||||
let r = yield mongo.batch([{_id: '0'}, {_id: '1'}], DB_TYPE);
|
||||
expect(r.insertedCount).to.equal(2);
|
||||
try {
|
||||
r = yield mongo.batch([{ _id:'0' }, { _id:'1' }], DB_TYPE);
|
||||
} catch(e) {
|
||||
r = yield mongo.batch([{_id: '0'}, {_id: '1'}], DB_TYPE);
|
||||
} catch (e) {
|
||||
expect(e.message).to.match(/duplicate/);
|
||||
}
|
||||
});
|
||||
@@ -59,37 +59,36 @@ describe('Mongo Integration Tests', function() {
|
||||
|
||||
describe("update", () => {
|
||||
it('should update a document', function *() {
|
||||
let r = yield mongo.create({ _id:'0' }, DB_TYPE);
|
||||
r = yield mongo.update({ _id:'0' }, { foo:'bar' }, DB_TYPE);
|
||||
let r = yield mongo.create({_id: '0'}, DB_TYPE);
|
||||
r = yield mongo.update({_id: '0'}, {foo: 'bar'}, DB_TYPE);
|
||||
expect(r.modifiedCount).to.equal(1);
|
||||
r = yield mongo.get({ _id:'0' }, DB_TYPE);
|
||||
r = yield mongo.get({_id: '0'}, DB_TYPE);
|
||||
expect(r.foo).to.equal('bar');
|
||||
});
|
||||
});
|
||||
|
||||
describe("get", () => {
|
||||
it('should get a document', function *() {
|
||||
let r = yield mongo.create({ _id:'0' }, DB_TYPE);
|
||||
r = yield mongo.get({ _id:'0' }, DB_TYPE);
|
||||
let r = yield mongo.create({_id: '0'}, DB_TYPE);
|
||||
r = yield mongo.get({_id: '0'}, DB_TYPE);
|
||||
expect(r).to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
describe("list", () => {
|
||||
it('should list documents', function *() {
|
||||
let r = yield mongo.batch([{ _id:'0', foo:'bar' }, { _id:'1', foo:'bar' }], DB_TYPE);
|
||||
r = yield mongo.list({ foo:'bar' }, DB_TYPE);
|
||||
expect(r).to.deep.equal([{ _id:'0', foo:'bar' }, { _id:'1', foo:'bar' }], DB_TYPE);
|
||||
let r = yield mongo.batch([{_id: '0', foo: 'bar'}, {_id: '1', foo: 'bar'}], DB_TYPE);
|
||||
r = yield mongo.list({foo: 'bar'}, DB_TYPE);
|
||||
expect(r).to.deep.equal([{_id: '0', foo: 'bar'}, {_id: '1', foo: 'bar'}], DB_TYPE);
|
||||
});
|
||||
});
|
||||
|
||||
describe("remove", () => {
|
||||
it('should remove a document', function *() {
|
||||
let r = yield mongo.create({ _id:'0' }, DB_TYPE);
|
||||
r = yield mongo.remove({ _id:'0' }, DB_TYPE);
|
||||
r = yield mongo.get({ _id:'0' }, DB_TYPE);
|
||||
let r = yield mongo.create({_id: '0'}, DB_TYPE);
|
||||
r = yield mongo.remove({_id: '0'}, DB_TYPE);
|
||||
r = yield mongo.get({_id: '0'}, DB_TYPE);
|
||||
expect(r).to.not.exist;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user