Last active
October 15, 2015 16:59
-
-
Save RobbertWolfs/fde357daf24b2517de46 to your computer and use it in GitHub Desktop.
Revisions
-
RobbertWolfs revised this gist
Oct 15, 2015 . 1 changed file with 6 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,22 +1,15 @@ it('should return objects', function () { var backend = { transfer: sandbox.stub() }; var stub2 = sandbox.stub(repository, 'getMails').returns([ {id: 123, to: 'peter.cosemans@gmail.com', body: 'aaaa...'}, {id: 123, to: 'wim.vanhoye@euri.com', body: 'bbb...'} ]); mailSystem.transferEuriMails(backend); expect(stub2).to.have.been.called; var mails = stub2.returnValues[0][0]; expect(mails).to.include.keys(['to', 'id', 'body']); expect(backend.transfer).to.have.been.called; }); -
RobbertWolfs created this gist
Oct 15, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ it('should return objects', function() { var stub = sandbox.stub(); var backend = { transfer: function(mails) { console.log(mails); } }; stub.withArgs(backend).yieldsTo("transfer", [ { id: 123, to: 'peter.cosemans@gmail.com', body: 'aaaa...'}]); stub(backend); var stub2 = sandbox.stub(repository, 'getMails').returns([ { id: 123, to: 'peter.cosemans@gmail.com', body: 'aaaa...'}, { id: 123, to: 'wim.vanhoye@euri.com', body: 'bbb...'} ]); mailSystem.transferEuriMails(backend); expect(stub2).to.have.been.called; var mails = stub2.returnValues[0][0]; expect(mails).to.include.keys(['to', 'id', 'body']); });