it("should call callback with update's error", function(done) { update.yields("my error!"); SM.updateQuestion(qid, updateData, function(err) { err.should.eql("my error!"); done(); }); });
it("should call update on the questions without modifications to data", function(done) { update.yields(); SM.updateQuestion(qid, updateData, function(err) { update.callCount.should.eql(1); var args = update.getCall(0).args; args[0].should.eql({_id: DB.getObjID(qid)}); args[1].should.eql({ $set: {"qOptions.foo": "placeholder"} }); done(); }); });
it("should call update on the questions with the passed-in update options", function(done) { update.yields(); SM.updateQuestion(qid, updateData, function(err) { update.callCount.should.eql(1); var args = update.getCall(0).args; args[0].should.eql({_id: DB.getObjID(qid)}); args[1].should.eql({ $set: {"qOptions.foo": "placeholder", qTxt: "I am here!"} }); done(); }); });