Last active
December 11, 2017 07:39
-
-
Save amitnabarro/51e879ebf22d0dee569fd006a07f9637 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
it('returns an object containing all users', done => { | |
const server = sinon.fakeServer.create() | |
server.respondWith('GET', '/users', [ | |
200, | |
{ 'Content-Type': 'application/json' }, | |
'[{ "id": 1, "name": "Brian" }, { "id": 2, "name": "Ron" }]' | |
]) | |
Users.all() | |
.done(collection => { | |
const expectedCollection = [ | |
{ id: 1, name: 'Brian' }, | |
{ id: 2, name: 'Ron' } | |
] | |
expect(collection.toJSON()).to.eql(expectedCollection) | |
done() | |
}) | |
server.respond() | |
server.restore() | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment