Skip to content

Commit 778158e

Browse files
committed
test(refs): test nested refs are unbound with their collection
1 parent cb68c10 commit 778158e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/refs-collections.spec.js

+15
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,18 @@ test('unbinds refs when the collection is unbound', async () => {
8888
spyA.mockRestore()
8989
spyB.mockRestore()
9090
})
91+
92+
test('unbinds nested refs when the collection is unbound', async () => {
93+
const items = db.collection()
94+
const spyA = spyUnbind(a)
95+
await items.add({ ref: { ref: a }})
96+
await vm.$bind('items', items)
97+
98+
expect(spyA).toHaveBeenCalledTimes(0)
99+
100+
vm.$unbind('items')
101+
102+
expect(spyA).toHaveBeenCalledTimes(1)
103+
104+
spyA.mockRestore()
105+
})

0 commit comments

Comments
 (0)