Skip to content

Commit

Permalink
test(unbind): test document unbind
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Nov 17, 2017
1 parent 7667fe5 commit 6511f35
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unbind.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ test('manually unbinds a collection', async t => {
await t.context.collection.add({ text: 'foo' })
t.deepEqual(vm.items, [])
})

test('manually unbinds a document', async t => {
const vm = t.context.vm
const spy = sinon.spy(vm._firestoreUnbinds, 'item')
vm.$unbind('item')
t.is(spy.callCount, 1)
t.deepEqual(Object.keys(vm._firestoreUnbinds), ['items'])
t.deepEqual(Object.keys(vm.$firestoreRefs), ['items'])
t.deepEqual(vm.item, null)
await t.context.document.update({ foo: 'foo' })
t.deepEqual(vm.item, null)
})

0 comments on commit 6511f35

Please sign in to comment.