44 extractRefs ,
55 firestoreDefaultConverter ,
66} from '../../src/firestore/utils'
7+ import { globalFirestoreOptions } from '../../src'
78import { setupFirestoreRefs } from '../utils'
89
910describe ( 'Firestore and Database utils' , ( ) => {
@@ -56,11 +57,12 @@ describe('Firestore and Database utils', () => {
5657 ref : docRef ,
5758 } ,
5859 undefined ,
59- { }
60+ { } ,
61+ globalFirestoreOptions
6062 )
6163 expect ( noRefsDoc . ref ) . toBe ( docRef . path )
6264 expect ( refs ) . toEqual ( {
63- ref : docRef ,
65+ ref : expect . objectContaining ( { id : docRef . id } ) ,
6466 } )
6567 } )
6668
@@ -72,7 +74,8 @@ describe('Firestore and Database utils', () => {
7274 bar : d ,
7375 } ,
7476 undefined ,
75- { }
77+ { } ,
78+ globalFirestoreOptions
7679 )
7780 expect ( doc . foo ) . toBe ( 1 )
7881 expect ( doc . bar ) . toBe ( d )
@@ -87,7 +90,8 @@ describe('Firestore and Database utils', () => {
8790 bar : d ,
8891 } ,
8992 undefined ,
90- { }
93+ { } ,
94+ globalFirestoreOptions
9195 )
9296 expect ( doc . foo ) . toBe ( 1 )
9397 expect ( doc . bar ) . toBe ( d )
@@ -102,7 +106,8 @@ describe('Firestore and Database utils', () => {
102106 bar : d ,
103107 } ,
104108 undefined ,
105- { }
109+ { } ,
110+ globalFirestoreOptions
106111 )
107112 expect ( doc . foo ) . toBe ( 1 )
108113 expect ( doc . bar ) . toBe ( d )
@@ -117,11 +122,12 @@ describe('Firestore and Database utils', () => {
117122 } ,
118123 } ,
119124 undefined ,
120- { }
125+ { } ,
126+ globalFirestoreOptions
121127 )
122128 expect ( noRefsDoc . obj . ref ) . toBe ( docRef . path )
123129 expect ( refs ) . toEqual ( {
124- 'obj.ref' : docRef ,
130+ 'obj.ref' : expect . objectContaining ( { id : docRef . id } ) ,
125131 } )
126132 } )
127133
@@ -134,7 +140,8 @@ describe('Firestore and Database utils', () => {
134140 } ,
135141 } ,
136142 undefined ,
137- { }
143+ { } ,
144+ globalFirestoreOptions
138145 )
139146 expect ( noRefsDoc ) . toEqual ( {
140147 a : null ,
@@ -155,11 +162,12 @@ describe('Firestore and Database utils', () => {
155162 } ,
156163 } ,
157164 undefined ,
158- { }
165+ { } ,
166+ globalFirestoreOptions
159167 )
160168 expect ( noRefsDoc . obj . nested . ref ) . toBe ( docRef . path )
161169 expect ( refs ) . toEqual ( {
162- 'obj.nested.ref' : docRef ,
170+ 'obj.nested.ref' : expect . objectContaining ( { id : docRef . id } ) ,
163171 } )
164172 } )
165173
@@ -170,15 +178,16 @@ describe('Firestore and Database utils', () => {
170178 arr : [ docRef , docRef2 , docRef ] ,
171179 } ,
172180 undefined ,
173- { }
181+ { } ,
182+ globalFirestoreOptions
174183 )
175184 expect ( noRefsDoc . arr [ 0 ] ) . toBe ( docRef . path )
176185 expect ( noRefsDoc . arr [ 1 ] ) . toBe ( docRef2 . path )
177186 expect ( noRefsDoc . arr [ 2 ] ) . toBe ( docRef . path )
178187 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 } ) ,
182191 } )
183192 } )
184193
@@ -188,7 +197,12 @@ describe('Firestore and Database utils', () => {
188197 value : 'foo' ,
189198 enumerable : false ,
190199 } )
191- const [ noRefsDoc , refs ] = extractRefs ( obj , undefined , { } )
200+ const [ noRefsDoc , refs ] = extractRefs (
201+ obj ,
202+ undefined ,
203+ { } ,
204+ globalFirestoreOptions
205+ )
192206 expect ( Object . getOwnPropertyDescriptor ( noRefsDoc , 'bar' ) ) . toEqual ( {
193207 value : 'foo' ,
194208 enumerable : false ,
0 commit comments