4
4
extractRefs ,
5
5
firestoreDefaultConverter ,
6
6
} from '../../src/firestore/utils'
7
+ import { globalFirestoreOptions } from '../../src'
7
8
import { setupFirestoreRefs } from '../utils'
8
9
9
10
describe ( 'Firestore and Database utils' , ( ) => {
@@ -56,11 +57,12 @@ describe('Firestore and Database utils', () => {
56
57
ref : docRef ,
57
58
} ,
58
59
undefined ,
59
- { }
60
+ { } ,
61
+ globalFirestoreOptions
60
62
)
61
63
expect ( noRefsDoc . ref ) . toBe ( docRef . path )
62
64
expect ( refs ) . toEqual ( {
63
- ref : docRef ,
65
+ ref : expect . objectContaining ( { id : docRef . id } ) ,
64
66
} )
65
67
} )
66
68
@@ -72,7 +74,8 @@ describe('Firestore and Database utils', () => {
72
74
bar : d ,
73
75
} ,
74
76
undefined ,
75
- { }
77
+ { } ,
78
+ globalFirestoreOptions
76
79
)
77
80
expect ( doc . foo ) . toBe ( 1 )
78
81
expect ( doc . bar ) . toBe ( d )
@@ -87,7 +90,8 @@ describe('Firestore and Database utils', () => {
87
90
bar : d ,
88
91
} ,
89
92
undefined ,
90
- { }
93
+ { } ,
94
+ globalFirestoreOptions
91
95
)
92
96
expect ( doc . foo ) . toBe ( 1 )
93
97
expect ( doc . bar ) . toBe ( d )
@@ -102,7 +106,8 @@ describe('Firestore and Database utils', () => {
102
106
bar : d ,
103
107
} ,
104
108
undefined ,
105
- { }
109
+ { } ,
110
+ globalFirestoreOptions
106
111
)
107
112
expect ( doc . foo ) . toBe ( 1 )
108
113
expect ( doc . bar ) . toBe ( d )
@@ -117,11 +122,12 @@ describe('Firestore and Database utils', () => {
117
122
} ,
118
123
} ,
119
124
undefined ,
120
- { }
125
+ { } ,
126
+ globalFirestoreOptions
121
127
)
122
128
expect ( noRefsDoc . obj . ref ) . toBe ( docRef . path )
123
129
expect ( refs ) . toEqual ( {
124
- 'obj.ref' : docRef ,
130
+ 'obj.ref' : expect . objectContaining ( { id : docRef . id } ) ,
125
131
} )
126
132
} )
127
133
@@ -134,7 +140,8 @@ describe('Firestore and Database utils', () => {
134
140
} ,
135
141
} ,
136
142
undefined ,
137
- { }
143
+ { } ,
144
+ globalFirestoreOptions
138
145
)
139
146
expect ( noRefsDoc ) . toEqual ( {
140
147
a : null ,
@@ -155,11 +162,12 @@ describe('Firestore and Database utils', () => {
155
162
} ,
156
163
} ,
157
164
undefined ,
158
- { }
165
+ { } ,
166
+ globalFirestoreOptions
159
167
)
160
168
expect ( noRefsDoc . obj . nested . ref ) . toBe ( docRef . path )
161
169
expect ( refs ) . toEqual ( {
162
- 'obj.nested.ref' : docRef ,
170
+ 'obj.nested.ref' : expect . objectContaining ( { id : docRef . id } ) ,
163
171
} )
164
172
} )
165
173
@@ -170,15 +178,16 @@ describe('Firestore and Database utils', () => {
170
178
arr : [ docRef , docRef2 , docRef ] ,
171
179
} ,
172
180
undefined ,
173
- { }
181
+ { } ,
182
+ globalFirestoreOptions
174
183
)
175
184
expect ( noRefsDoc . arr [ 0 ] ) . toBe ( docRef . path )
176
185
expect ( noRefsDoc . arr [ 1 ] ) . toBe ( docRef2 . path )
177
186
expect ( noRefsDoc . arr [ 2 ] ) . toBe ( docRef . path )
178
187
expect ( refs ) . toEqual ( {
179
- 'arr.0' : docRef ,
180
- 'arr.1' : docRef2 ,
181
- 'arr.2' : docRef ,
188
+ 'arr.0' : expect . objectContaining ( { id : docRef . id } ) ,
189
+ 'arr.1' : expect . objectContaining ( { id : docRef2 . id } ) ,
190
+ 'arr.2' : expect . objectContaining ( { id : docRef . id } ) ,
182
191
} )
183
192
} )
184
193
@@ -188,7 +197,12 @@ describe('Firestore and Database utils', () => {
188
197
value : 'foo' ,
189
198
enumerable : false ,
190
199
} )
191
- const [ noRefsDoc , refs ] = extractRefs ( obj , undefined , { } )
200
+ const [ noRefsDoc , refs ] = extractRefs (
201
+ obj ,
202
+ undefined ,
203
+ { } ,
204
+ globalFirestoreOptions
205
+ )
192
206
expect ( Object . getOwnPropertyDescriptor ( noRefsDoc , 'bar' ) ) . toEqual ( {
193
207
value : 'foo' ,
194
208
enumerable : false ,
0 commit comments