Skip to content

Instantly share code, notes, and snippets.

@amitnabarro
Last active December 11, 2017 07:39
Show Gist options
  • Save amitnabarro/51e879ebf22d0dee569fd006a07f9637 to your computer and use it in GitHub Desktop.
Save amitnabarro/51e879ebf22d0dee569fd006a07f9637 to your computer and use it in GitHub Desktop.
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