示例#1
0
 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();
   });
 });
示例#2
0
 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();
   });
 });
示例#3
0
 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();
   });
 });