@@ -10,6 +10,7 @@ import {
10
10
DocumentData ,
11
11
Query ,
12
12
setDoc ,
13
+ updateDoc ,
13
14
} from 'firebase/firestore'
14
15
import { expectType , setupFirestoreRefs , tds , firestore } from '../utils'
15
16
import { type Ref } from 'vue'
@@ -92,6 +93,24 @@ describe('Firestore collections', () => {
92
93
expect ( wrapper . vm . list ) . toContainEqual ( { name : 'b' } )
93
94
} )
94
95
96
+ it ( 'updates items of the collection' , async ( ) => {
97
+ const { wrapper, listRef } = factory < { name : string } > ( )
98
+
99
+ const aRef = doc ( listRef )
100
+ const a = await setDoc ( aRef , { name : 'a' } )
101
+ const bRef = doc ( listRef )
102
+ const b = await setDoc ( bRef , { name : 'b' } )
103
+ const cRef = doc ( listRef )
104
+ const c = await setDoc ( cRef , { name : 'c' } )
105
+
106
+ await setDoc ( aRef , { name : 'aa' } )
107
+ await updateDoc ( cRef , { name : 'cc' } )
108
+ expect ( wrapper . vm . list ) . toHaveLength ( 3 )
109
+ expect ( wrapper . vm . list ) . toContainEqual ( { name : 'aa' } )
110
+ expect ( wrapper . vm . list ) . toContainEqual ( { name : 'b' } )
111
+ expect ( wrapper . vm . list ) . toContainEqual ( { name : 'cc' } )
112
+ } )
113
+
95
114
tds ( ( ) => {
96
115
interface TodoI {
97
116
text : string
0 commit comments