Skip to content

Commit

Permalink
Adds the same test when the model belongs to a collection (passes)
Browse files Browse the repository at this point in the history
  • Loading branch information
rdiazv committed Jun 27, 2017
1 parent b612355 commit 9c13631
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions __tests__/Model.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ describe('Model', () => {
model.save(item)
expect(collection.create).toBeCalledWith(model, { optimistic: true })
})

it('sends merged attributes on the request', () => {
const adapter = apiClient()
const spy = jest.spyOn(adapter, 'post')

model.save({ name })

expect(spy).toHaveBeenCalledTimes(1)
expect(spy.mock.calls[0][1]).toEqual({
name: 'dylan',
album: 'kind of blue'
})

spy.mockReset()
spy.mockRestore()
})
})

describe('and it does not have a collection', () => {
Expand Down

0 comments on commit 9c13631

Please sign in to comment.