Skip to content

Commit 600fe7b

Browse files
committed
test(refs): test multiple refs at the same time
1 parent f74bfee commit 600fe7b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

test/refs.spec.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,30 @@ test('unbinds nested refs when the document is unbound', async () => {
212212
cSpy.mockRestore()
213213
dSpy.mockRestore()
214214
})
215+
216+
test('unbinds multiple refs when the document is unbound', async () => {
217+
const c = collection.doc()
218+
const d = collection.doc()
219+
const aSpy = spyUnbind(a)
220+
const cSpy = spyUnbind(c)
221+
const dSpy = spyUnbind(d)
222+
223+
await a.update({ a: true })
224+
await c.update({ c: true })
225+
await d.update({ c, a })
226+
227+
await vm.$bind('d', d)
228+
expect(vm.d).toEqual({
229+
a: { a: true },
230+
c: { c: true }
231+
})
232+
vm.$unbind('d')
233+
234+
expect(dSpy.mock.calls.length).toBe(1)
235+
expect(cSpy.mock.calls.length).toBe(1)
236+
expect(aSpy.mock.calls.length).toBe(1)
237+
238+
aSpy.mockRestore()
239+
cSpy.mockRestore()
240+
dSpy.mockRestore()
241+
})

0 commit comments

Comments
 (0)