Skip to content

Commit 6511f35

Browse files
committed
test(unbind): test document unbind
1 parent 7667fe5 commit 6511f35

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/unbind.spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,15 @@ test('manually unbinds a collection', async t => {
4646
await t.context.collection.add({ text: 'foo' })
4747
t.deepEqual(vm.items, [])
4848
})
49+
50+
test('manually unbinds a document', async t => {
51+
const vm = t.context.vm
52+
const spy = sinon.spy(vm._firestoreUnbinds, 'item')
53+
vm.$unbind('item')
54+
t.is(spy.callCount, 1)
55+
t.deepEqual(Object.keys(vm._firestoreUnbinds), ['items'])
56+
t.deepEqual(Object.keys(vm.$firestoreRefs), ['items'])
57+
t.deepEqual(vm.item, null)
58+
await t.context.document.update({ foo: 'foo' })
59+
t.deepEqual(vm.item, null)
60+
})

0 commit comments

Comments
 (0)