From ee802c64902ac0c7ef915da20f7299c948a6210f Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Thu, 23 Apr 2015 16:22:21 +0200 Subject: [PATCH] Updated model and instance tests --- test/Instance.js | 141 ++++++++++++++++++++++++++++++++++ test/Instance.js.map | 2 +- test/Instance.ts | 176 ++++++++++++++++++++++++++++++++++++++++++- test/Model.js | 95 ++++++++++++++++++++--- test/Model.js.map | 2 +- test/Model.ts | 116 ++++++++++++++++++++++++---- 6 files changed, 505 insertions(+), 27 deletions(-) diff --git a/test/Instance.js b/test/Instance.js index 050ee88..62d2c9b 100644 --- a/test/Instance.js +++ b/test/Instance.js @@ -35,6 +35,7 @@ describe("Instance", function () { var core = new TestDB(); before(function () { return core.connect(); }); after(function () { return core.close(); }); + beforeEach(function () { return core.Test.remove(); }); it("should expose the latest document values", function () { var instance = core.Test.helpers.wrapDocument({ id: 'aaaaaa', @@ -88,5 +89,145 @@ describe("Instance", function () { chai.expect(instance).to.exist; chai.expect(instance.test).to.exist.and.be.a('function'); }); + describe("save()", function () { + beforeEach(function () { return core.Test.remove(); }); + it("should avoid making calls to the database if no changes were made to the instance", function () { + var update = core.Test.collection.update; + core.Test.collection.update = function () { + chai.assert.fail(); + }; + return core.Test.insert({ + answer: 1 + }).then(function () { return chai.expect(core.Test.get().then(function (instance) { + return instance.save().then(function () { + core.Test.collection.update = update; + }); + })); }); + }); + it("should insert the instance if it is not present in the database", function () { + var instance = new core.Test.Instance({ + answer: 1 + }); + chai.expect(instance._isNew).to.be.true; + return chai.expect(instance.save().then(function () { return chai.expect(core.Test.get(instance.id)).to.eventually.have.property('answer', instance.answer); })).to.eventually.be.ok; + }); + it("should automatically generate the update query if one was not provided", function () { + return core.Test.insert({ + answer: 1 + }).then(function () { return chai.expect(core.Test.get().then(function (instance) { + instance.answer = 42; + return instance.save().then(function () { return core.Test.get(instance.id); }); + })).to.eventually.have.property('answer', 42); }); + }); + it("should allow you to specify a custom update query", function () { + return core.Test.insert({ + answer: 1 + }).then(function () { return core.Test.get(); }).then(function (instance) { return chai.expect(instance.save({ $set: { answer: 10 } })).to.eventually.have.property('answer', 10); }); + }); + it("should allow you tp specify a custom update query and conditions for the update", function () { + return core.Test.insert({ + answer: 1 + }).then(function () { return core.Test.get(); }).then(function (instance) { return chai.expect(instance.save({ answer: { $lt: 5 } }, { $set: { answer: 10 } })).to.eventually.have.property('answer', 10); }); + }); + it("should return a promise for the instance", function () { + return core.Test.insert({ + answer: 1 + }).then(function () { return core.Test.get(); }).then(function (instance) { return chai.expect(instance.save()).to.eventually.equal(instance); }); + }); + it("should allow the use of a callback instead of promises", function (done) { + core.Test.insert({ + answer: 1 + }).then(function () { return core.Test.get(); }).then(function (instance) { + instance.save(function (err, result) { + if (err) + return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); + describe("update()", function () { + beforeEach(function () { return core.Test.remove().then(function () { return core.Test.insert({ answer: 1 }); }); }); + it("should not replace the instance", function () { + return core.Test.get().then(function (instance) { return chai.expect(instance.update()).to.eventually.equal(instance); }); + }); + it("should update the instance's properties", function () { + return core.Test.get().then(function (instance) { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(function () { return chai.expect(instance.update()).to.eventually.have.property('answer', 10); }); + }); + }); + it("should return a promise for the instance", function () { + return core.Test.get().then(function (instance) { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(function () { return chai.expect(instance.update()).to.eventually.equal(instance); }); + }); + }); + it("should allow the use of a callback instead of promises", function (done) { + core.Test.get().then(function (instance) { + instance.update(function (err, result) { + if (err) + return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); + describe("refresh()", function () { + beforeEach(function () { return core.Test.remove().then(function () { return core.Test.insert({ answer: 1 }); }); }); + it("should not replace the instance", function () { + return core.Test.get().then(function (instance) { return chai.expect(instance.update()).to.eventually.equal(instance); }); + }); + it("should update the instance's properties", function () { + return core.Test.get().then(function (instance) { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(function () { return chai.expect(instance.refresh()).to.eventually.have.property('answer', 10); }); + }); + }); + it("should return a promise for the instance", function () { + return core.Test.get().then(function (instance) { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(function () { return chai.expect(instance.refresh()).to.eventually.equal(instance); }); + }); + }); + it("should allow the use of a callback instead of promises", function (done) { + core.Test.get().then(function (instance) { + instance.refresh(function (err, result) { + if (err) + return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); + describe("remove()", function () { + beforeEach(function () { return core.Test.remove().then(function () { return core.Test.insert({ answer: 1 }); }); }); + it("should remove the document from the database", function () { + return chai.expect(core.Test.get().then(function (instance) { return instance.remove(); }).then(function () { return core.Test.get(); })).to.eventually.be.null; + }); + it("should set the instance's isNew property to true", function () { + return chai.expect(core.Test.get().then(function (instance) { return instance.remove(); })).to.eventually.have.property('_isNew', true); + }); + it("should return a promise for the instance", function () { + return core.Test.get().then(function (instance) { return chai.expect(instance.remove()).to.eventually.equal(instance); }); + }); + it("should allow the use of a callback instead of promises", function (done) { + core.Test.get().then(function (instance) { + instance.remove(function (err, result) { + if (err) + return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); }); //# sourceMappingURL=Instance.js.map \ No newline at end of file diff --git a/test/Instance.js.map b/test/Instance.js.map index 1e2f2d5..450e590 100644 --- a/test/Instance.js.map +++ b/test/Instance.js.map @@ -1 +1 @@ -{"version":3,"file":"Instance.js","sourceRoot":"","sources":["Instance.ts"],"names":["Test","Test.constructor","Test.test","Test.ansqr","TestDB","TestDB.constructor"],"mappings":";;;;;;AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAOrC,IAAM,IAAI;IAASA,UAAbA,IAAIA,UAA6CA;IAAvDA,SAAMA,IAAIA;QAASC,8BAAoCA;IAWvDA,CAACA;IAPGD,mBAAIA,GAAJA;QACIE,MAAMA,CAACA,IAAIA,CAACA;IAChBA,CAACA;IAED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E,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QAChH,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8CAA8C,EAAC;QAC9C,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;YAC1C,EAAE,EAAE,QAAQ;YACZ,MAAM,EAAE,CAAC;SACZ,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAC;QAClC,IAAI,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;YAC1C,EAAE,EAAE,QAAQ;YACZ,MAAM,EAAE,CAAC;SACZ,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Instance.js","sourceRoot":"","sources":["Instance.ts"],"names":["Test","Test.constructor","Test.test","Test.ansqr","TestDB","TestDB.constructor"],"mappings":";;;;;;AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAO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C,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/Instance.ts b/test/Instance.ts index 7f4c679..d6bd8bc 100644 --- a/test/Instance.ts +++ b/test/Instance.ts @@ -2,7 +2,7 @@ import Iridium = require('../index'); interface TestDocument { - id: string; + id?: string; answer: number; } @@ -33,6 +33,8 @@ describe("Instance",() => { before(() => core.connect()); after(() => core.close()); + beforeEach(() => core.Test.remove()); + it("should expose the latest document values",() => { var instance = core.Test.helpers.wrapDocument({ id: 'aaaaaa', @@ -79,7 +81,7 @@ describe("Instance",() => { chai.expect(core.Test.helpers.wrapDocument({ id: '1', answer: 2 }).document).to.eql({ id: '1', answer: 2 }); }); }); - + it("should expose additional getters and setters",() => { var instance = core.Test.helpers.wrapDocument({ id: 'aaaaaa', @@ -99,4 +101,174 @@ describe("Instance",() => { chai.expect(instance).to.exist; chai.expect(instance.test).to.exist.and.be.a('function'); }); + + describe("save()",() => { + + beforeEach(() => core.Test.remove()); + + it("should avoid making calls to the database if no changes were made to the instance",() => { + var update = core.Test.collection.update; + core.Test.collection.update = () => { + chai.assert.fail(); + }; + + return core.Test.insert({ + answer: 1 + }).then(() => chai.expect(core.Test.get().then((instance) => { + return instance.save().then(() => { + core.Test.collection.update = update; + }); + }))); + }); + + it("should insert the instance if it is not present in the database",() => { + var instance = new core.Test.Instance({ + answer: 1 + }); + + chai.expect((instance)._isNew).to.be.true; + return chai.expect(instance.save().then(() => chai.expect(core.Test.get(instance.id)).to.eventually.have.property('answer', instance.answer))).to.eventually.be.ok; + }); + + it("should automatically generate the update query if one was not provided",() => { + return core.Test.insert({ + answer: 1 + }).then(() => chai.expect(core.Test.get().then((instance) => { + instance.answer = 42; + return instance.save().then(() => core.Test.get(instance.id)); + })).to.eventually.have.property('answer', 42)); + }); + + it("should allow you to specify a custom update query",() => { + return core.Test.insert({ + answer: 1 + }) + .then(() => core.Test.get()) + .then((instance) => chai.expect(instance.save({ $set: { answer: 10 } })).to.eventually.have.property('answer', 10)); + }); + + it("should allow you tp specify a custom update query and conditions for the update",() => { + return core.Test.insert({ + answer: 1 + }) + .then(() => core.Test.get()) + .then((instance) => chai.expect(instance.save({ answer: { $lt: 5 } }, { $set: { answer: 10 } })).to.eventually.have.property('answer', 10)); + }); + + it("should return a promise for the instance",() => { + return core.Test.insert({ + answer: 1 + }) + .then(() => core.Test.get()) + .then((instance) => chai.expect(instance.save()).to.eventually.equal(instance)); + }); + + it("should allow the use of a callback instead of promises",(done) => { + core.Test.insert({ + answer: 1 + }) + .then(() => core.Test.get()) + .then((instance) => { + instance.save((err, result) => { + if (err) return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); + + describe("update()",() => { + beforeEach(() => core.Test.remove().then(() => core.Test.insert({ answer: 1 }))); + + it("should not replace the instance",() => { + return core.Test.get().then((instance) => chai.expect(instance.update()).to.eventually.equal(instance)); + }); + + it("should update the instance's properties",() => { + return core.Test.get().then((instance) => { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(() => chai.expect(instance.update()).to.eventually.have.property('answer', 10)); + }); + }); + + it("should return a promise for the instance",() => { + return core.Test.get().then((instance) => { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(() => chai.expect(instance.update()).to.eventually.equal(instance)); + }); + }); + + it("should allow the use of a callback instead of promises",(done) => { + core.Test.get().then((instance) => { + instance.update((err, result) => { + if (err) return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); + + describe("refresh()",() => { + beforeEach(() => core.Test.remove().then(() => core.Test.insert({ answer: 1 }))); + + it("should not replace the instance",() => { + return core.Test.get().then((instance) => chai.expect(instance.update()).to.eventually.equal(instance)); + }); + + it("should update the instance's properties",() => { + return core.Test.get().then((instance) => { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(() => chai.expect(instance.refresh()).to.eventually.have.property('answer', 10)); + }); + }); + + it("should return a promise for the instance",() => { + return core.Test.get().then((instance) => { + core.Test.update({ id: instance.id }, { + $set: { answer: 10 } + }).then(() => chai.expect(instance.refresh()).to.eventually.equal(instance)); + }); + }); + + it("should allow the use of a callback instead of promises",(done) => { + core.Test.get().then((instance) => { + instance.refresh((err, result) => { + if (err) return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); + + describe("remove()",() => { + beforeEach(() => core.Test.remove().then(() => core.Test.insert({ answer: 1 }))); + + it("should remove the document from the database",() => { + return chai.expect(core.Test.get().then((instance) => instance.remove()).then(() => core.Test.get())).to.eventually.be.null; + }); + + it("should set the instance's isNew property to true",() => { + return chai.expect(core.Test.get().then((instance) => instance.remove())).to.eventually.have.property('_isNew', true); + }); + + it("should return a promise for the instance",() => { + return core.Test.get().then((instance) => chai.expect(instance.remove()).to.eventually.equal(instance)); + }); + + it("should allow the use of a callback instead of promises",(done) => { + core.Test.get().then((instance) => { + instance.remove((err, result) => { + if (err) return done(err); + chai.expect(result).to.equal(instance); + return done(); + }); + }); + }); + }); }); \ No newline at end of file diff --git a/test/Model.js b/test/Model.js index ca0a477..8cc97a1 100644 --- a/test/Model.js +++ b/test/Model.js @@ -108,7 +108,7 @@ describe("Model", function () { it("should expose cacheDirector", function () { return chai.expect(test).to.have.property('cacheDirector'); }); it("should expose Instance", function () { return chai.expect(test.Instance).to.exist.and.be.a('function'); }); }); - var createTests = function () { + describe("create()", function () { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); before(function () { return core.connect(); @@ -118,7 +118,6 @@ describe("Model", function () { }); it("should exist", function () { chai.expect(model.create).to.exist.and.be.a('function'); - chai.expect(model.insert).to.exist.and.be.a('function'); }); it("should allow the insertion of a single document", function () { return chai.expect(model.create({ answer: 10 })).to.eventually.be.ok; @@ -136,6 +135,42 @@ describe("Model", function () { it("should allow you to provide options to control the creation", function () { return chai.expect(model.create({ answer: 14 }, { upsert: true })).to.eventually.exist; }); + it("should support a callback style instead of promises", function (done) { + model.create({ answer: 15 }, function (err, inserted) { + if (err) + return done(err); + chai.expect(inserted).to.exist.and.have.property('answer', 15); + return done(); + }); + }); + }); + describe("insert()", function () { + var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); + before(function () { + return core.connect(); + }); + after(function () { + return model.remove().then(function () { return core.close(); }); + }); + it("should exist", function () { + chai.expect(model.insert).to.exist.and.be.a('function'); + }); + it("should allow the insertion of a single document", function () { + return chai.expect(model.insert({ answer: 10 })).to.eventually.be.ok; + }); + it("should return a document if a single document is inserted", function () { + return chai.expect(model.insert({ answer: 10 })).to.eventually.have.property('answer', 10); + }); + it("should allow the insertion of multiple documents", function () { + return chai.expect(model.insert([ + { answer: 11 }, + { answer: 12 }, + { answer: 13 } + ])).to.eventually.exist.and.have.lengthOf(3); + }); + it("should allow you to provide options to control the creation", function () { + return chai.expect(model.insert({ answer: 14 }, { upsert: true })).to.eventually.exist; + }); it("should support a callback style instead of promises", function (done) { model.insert({ answer: 15 }, function (err, inserted) { if (err) @@ -144,9 +179,7 @@ describe("Model", function () { return done(); }); }); - }; - describe("create()", createTests); - describe("insert()", createTests); + }); describe("remove()", function () { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); before(function () { @@ -179,7 +212,7 @@ describe("Model", function () { }); }); }); - var findOneTests = function () { + describe("findOne()", function () { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); before(function () { return core.connect().then(function () { return model.remove(); }).then(function () { return model.insert([ @@ -195,7 +228,6 @@ describe("Model", function () { }); it("should exist", function () { chai.expect(model.findOne).to.exist.and.be.a('function'); - chai.expect(model.get).to.exist.and.be.a('function'); }); it("should support retrieving an random document", function () { return chai.expect(model.findOne()).to.eventually.exist.and.have.property('answer').is.a('number'); @@ -224,9 +256,52 @@ describe("Model", function () { return done(); }); }); - }; - describe("findOne()", findOneTests); - describe("get()", findOneTests); + }); + describe("get()", function () { + var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); + before(function () { + return core.connect().then(function () { return model.remove(); }).then(function () { return model.insert([ + { answer: 10 }, + { answer: 11 }, + { answer: 12 }, + { answer: 13 }, + { answer: 14 } + ]); }); + }); + after(function () { + return model.remove().then(function () { return core.close(); }); + }); + it("should exist", function () { + chai.expect(model.get).to.exist.and.be.a('function'); + }); + it("should support retrieving an random document", function () { + return chai.expect(model.get()).to.eventually.exist.and.have.property('answer').is.a('number'); + }); + it("should support retrieving a document using its ID", function () { + return chai.expect(model.get().then(function (doc) { return model.get(doc.id); })).to.eventually.exist.and.have.property('answer').is.a('number'); + }); + it("should retrieve the correct document by its ID", function () { + return model.get().then(function (doc) { + return chai.expect(model.get(doc.id)).to.eventually.exist.and.have.property('id', doc.id); + }); + }); + it("should support retrieving a document using a selector query", function () { + return chai.expect(model.get({ answer: 10 })).to.eventually.exist.and.have.property('answer', 10); + }); + it("should support passing options to control the query", function () { + return chai.expect(model.get({}, { + sort: { answer: -1 } + })).to.eventually.exist.and.have.property('answer', 14); + }); + it("should support a callback style instead of promises", function (done) { + model.get(function (err, doc) { + if (err) + return done(err); + chai.expect(doc).to.exist.and.have.property('answer'); + return done(); + }); + }); + }); describe("find()", function () { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); before(function () { diff --git a/test/Model.js.map b/test/Model.js.map index 9b37c26..ef8d248 100644 --- a/test/Model.js.map +++ b/test/Model.js.map @@ -1 +1 @@ -{"version":3,"file":"Model.js","sourceRoot":"","sources":["Model.ts"],"names":["Test","Test.constructor"],"mappings":";;;;;;AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAOrC,IAAM,IAAI;IAASA,UAAbA,IAAIA,UAA6CA;IAAvDA,SAAMA,IAAIA;QAASC,8BAAoCA;IAGvDA,CAACA;IAADD,WAACA;AAADA,CAACA,AAHD,EAAmB,OAAO,CAAC,QAAQ,EAGlC;AAED,QAAQ,CAAC,OAAO,EAAC;IACb,IAAI,IAAI,GAAG,IAAI,OAAO,CAAC,IAA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C;QAEH,KAAK,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,cAAM,OAAA,KAAK,CAAC,WAAW,EAAE,EAAnB,CAAmB,CAAC,CAAC,IAAI,CAAC,cAAM,OAAA,IAAI,CAAC,KAAK,EAAE,EAAZ,CAAY,CAAC,CAAC;QACnF,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,cAAc,EAAC;YACd,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAC;YACrD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,CAAC;QAClE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/Model.ts b/test/Model.ts index 007cbff..0b8d6e5 100644 --- a/test/Model.ts +++ b/test/Model.ts @@ -112,8 +112,8 @@ describe("Model",() => { it("should expose cacheDirector",() => chai.expect(test).to.have.property('cacheDirector')); it("should expose Instance",() => chai.expect(test.Instance).to.exist.and.be.a('function')); }); - - var createTests = () => { + + describe("create()",() => { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); before(() => { @@ -126,7 +126,6 @@ describe("Model",() => { it("should exist",() => { chai.expect(model.create).to.exist.and.be.a('function'); - chai.expect(model.insert).to.exist.and.be.a('function'); }); it("should allow the insertion of a single document",() => { @@ -150,16 +149,57 @@ describe("Model",() => { }); it("should support a callback style instead of promises",(done) => { - model.insert({ answer: 15 }, (err, inserted) => { + model.create({ answer: 15 },(err, inserted) => { if (err) return done(err); chai.expect(inserted).to.exist.and.have.property('answer', 15); return done(); }); }); - }; + }); + + describe("insert()",() => { + var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); + + before(() => { + return core.connect() + }); + + after(() => { + return model.remove().then(() => core.close()); + }); + + it("should exist",() => { + chai.expect(model.insert).to.exist.and.be.a('function'); + }); + + it("should allow the insertion of a single document",() => { + return chai.expect(model.insert({ answer: 10 })).to.eventually.be.ok; + }); + + it("should return a document if a single document is inserted",() => { + return chai.expect(model.insert({ answer: 10 })).to.eventually.have.property('answer', 10); + }); + + it("should allow the insertion of multiple documents",() => { + return chai.expect(model.insert([ + { answer: 11 }, + { answer: 12 }, + { answer: 13 } + ])).to.eventually.exist.and.have.lengthOf(3); + }); + + it("should allow you to provide options to control the creation",() => { + return chai.expect(model.insert({ answer: 14 }, { upsert: true })).to.eventually.exist; + }); - describe("create()", createTests); - describe("insert()", createTests); + it("should support a callback style instead of promises",(done) => { + model.insert({ answer: 15 },(err, inserted) => { + if (err) return done(err); + chai.expect(inserted).to.exist.and.have.property('answer', 15); + return done(); + }); + }); + }); describe("remove()",() => { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); @@ -198,8 +238,8 @@ describe("Model",() => { }); }); }); - - var findOneTests = () => { + + describe("findOne()",() => { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); before(() => { @@ -218,7 +258,6 @@ describe("Model",() => { it("should exist",() => { chai.expect(model.findOne).to.exist.and.be.a('function'); - chai.expect(model.get).to.exist.and.be.a('function'); }); it("should support retrieving an random document",() => { @@ -252,10 +291,61 @@ describe("Model",() => { return done(); }); }); - }; + }); + + describe("get()",() => { + var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number }); + + before(() => { + return core.connect().then(() => model.remove()).then(() => model.insert([ + { answer: 10 }, + { answer: 11 }, + { answer: 12 }, + { answer: 13 }, + { answer: 14 } + ])); + }); + + after(() => { + return model.remove().then(() => core.close()); + }); + + it("should exist",() => { + chai.expect(model.get).to.exist.and.be.a('function'); + }); + + it("should support retrieving an random document",() => { + return chai.expect(model.get()).to.eventually.exist.and.have.property('answer').is.a('number'); + }); + + it("should support retrieving a document using its ID",() => { + return chai.expect(model.get().then((doc) => model.get(doc.id))).to.eventually.exist.and.have.property('answer').is.a('number'); + }); + + it("should retrieve the correct document by its ID",() => { + return model.get().then((doc) => { + return chai.expect(model.get(doc.id)).to.eventually.exist.and.have.property('id', doc.id); + }); + }); + + it("should support retrieving a document using a selector query",() => { + return chai.expect(model.get({ answer: 10 })).to.eventually.exist.and.have.property('answer', 10); + }); + + it("should support passing options to control the query",() => { + return chai.expect(model.get({}, { + sort: { answer: -1 } + })).to.eventually.exist.and.have.property('answer', 14); + }); - describe("findOne()", findOneTests); - describe("get()", findOneTests); + it("should support a callback style instead of promises",(done) => { + model.get((err, doc) => { + if (err) return done(err); + chai.expect(doc).to.exist.and.have.property('answer'); + return done(); + }); + }); + }); describe("find()",() => { var model = new Iridium.Model(core, Test, 'test', { id: false, answer: Number });