-
-
Save nicholascloud/8f8a50506cd3077b2bd1 to your computer and use it in GitHub Desktop.
This file contains 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 characters
var mockDB = { | |
_data: [], | |
store: function (data) { | |
this._data.push(data); | |
} | |
}; | |
beforeEach(function () { | |
// reset the mockDB every time | |
mockDB._data = []; | |
}); | |
// the controller holds a reference to the mockDB, and will write to it | |
var matchController = new MatchController(mockDB); | |
it("holds the JSON response correctly in memory", function() { | |
var mockJSON = [{id: 1, name: 'spinach'}]; | |
//... | |
matchController.list(function (error, response, body) { | |
// something like this... | |
expect(mockDB._data).to.include(mockJSON[0]); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment