@@ -20,13 +20,7 @@ describe('collections', () => {
20
20
await new Promise ( ( res , rej ) => {
21
21
resolve = jest . fn ( res )
22
22
reject = jest . fn ( rej )
23
- unbind = bindCollection ( {
24
- target,
25
- collection,
26
- resolve,
27
- reject,
28
- ops,
29
- } )
23
+ unbind = bindCollection ( target , collection , ops , resolve , reject )
30
24
} )
31
25
} )
32
26
@@ -122,13 +116,7 @@ describe('collections', () => {
122
116
throw new Error ( 'Promise was not called' )
123
117
}
124
118
await new Promise ( ( resolve , reject ) => {
125
- unbind = bindCollection ( {
126
- target,
127
- collection,
128
- resolve,
129
- reject,
130
- ops,
131
- } )
119
+ unbind = bindCollection ( target , collection , ops , resolve , reject )
132
120
} )
133
121
134
122
expect ( unbindSpy ) . not . toHaveBeenCalled ( )
@@ -154,7 +142,7 @@ describe('collections', () => {
154
142
collection . onSnapshot = jest . fn ( fakeOnSnapshot )
155
143
await expect (
156
144
new Promise ( ( resolve , reject ) => {
157
- bindCollection ( { target, collection, resolve , reject , ops } )
145
+ bindCollection ( target , collection , ops , resolve , reject )
158
146
} )
159
147
) . rejects . toThrow ( )
160
148
// @ts -ignore
@@ -165,13 +153,7 @@ describe('collections', () => {
165
153
await collection . add ( { foo : 'foo' } )
166
154
await collection . add ( { foo : 'foo' } )
167
155
const promise = new Promise ( ( resolve , reject ) => {
168
- bindCollection ( {
169
- target,
170
- collection,
171
- resolve,
172
- reject,
173
- ops,
174
- } )
156
+ bindCollection ( target , collection , ops , resolve , reject )
175
157
} )
176
158
await promise
177
159
expect ( target . value ) . toEqual ( [ { foo : 'foo' } , { foo : 'foo' } ] )
@@ -183,13 +165,7 @@ describe('collections', () => {
183
165
throw new Error ( 'Promise was not called' )
184
166
}
185
167
const promise = new Promise ( ( resolve , reject ) => {
186
- unbind = bindCollection ( {
187
- target,
188
- collection,
189
- resolve,
190
- reject,
191
- ops,
192
- } )
168
+ unbind = bindCollection ( target , collection , ops , resolve , reject )
193
169
} )
194
170
await promise
195
171
expect ( target . value ) . toEqual ( [ { foo : 'foo' } ] )
@@ -203,13 +179,7 @@ describe('collections', () => {
203
179
throw new Error ( 'Promise was not called' )
204
180
}
205
181
const promise = new Promise ( ( resolve , reject ) => {
206
- unbind = bindCollection ( {
207
- target,
208
- collection,
209
- resolve,
210
- reject,
211
- ops,
212
- } )
182
+ unbind = bindCollection ( target , collection , ops , resolve , reject )
213
183
} )
214
184
await promise
215
185
expect ( target . value ) . toEqual ( [ { foo : 'foo' } ] )
@@ -223,13 +193,7 @@ describe('collections', () => {
223
193
throw new Error ( 'Promise was not called' )
224
194
}
225
195
const promise = new Promise ( ( resolve , reject ) => {
226
- unbind = bindCollection ( {
227
- target,
228
- collection,
229
- resolve,
230
- reject,
231
- ops,
232
- } )
196
+ unbind = bindCollection ( target , collection , ops , resolve , reject )
233
197
} )
234
198
await promise
235
199
expect ( target . value ) . toEqual ( [ { foo : 'foo' } ] )
@@ -244,10 +208,9 @@ describe('collections', () => {
244
208
await other . add ( { b : 1 } )
245
209
246
210
await new Promise ( ( resolve , reject ) => {
247
- unbind = bindCollection (
248
- { target, collection : other , resolve, reject, ops } ,
249
- { reset : false }
250
- )
211
+ unbind = bindCollection ( target , other , ops , resolve , reject , {
212
+ reset : false ,
213
+ } )
251
214
} )
252
215
expect ( target . value ) . toEqual ( [ { a : 0 } , { b : 1 } ] )
253
216
unbind ( )
@@ -265,10 +228,7 @@ describe('collections', () => {
265
228
// force the unbind without resetting the value
266
229
unbind ( false )
267
230
const promise = new Promise ( ( resolve , reject ) => {
268
- bindCollection (
269
- { target, collection : other , resolve, reject, ops } ,
270
- { wait : true }
271
- )
231
+ bindCollection ( target , other , ops , resolve , reject , { wait : true } )
272
232
} )
273
233
expect ( target . value ) . toEqual ( [ { foo : 'foo' } , { foo : 'foo' } ] )
274
234
await promise
@@ -283,16 +243,9 @@ describe('collections', () => {
283
243
// @ts -ignore
284
244
target . value = 'foo'
285
245
await new Promise ( ( resolve , reject ) => {
286
- bindCollection (
287
- {
288
- target,
289
- collection : db . collection ( ) as any ,
290
- resolve,
291
- reject,
292
- ops,
293
- } ,
294
- { wait : true }
295
- )
246
+ bindCollection ( target , db . collection ( ) as any , ops , resolve , reject , {
247
+ wait : true ,
248
+ } )
296
249
} )
297
250
expect ( target . value ) . toEqual ( [ ] )
298
251
} )
@@ -309,10 +262,7 @@ describe('collections', () => {
309
262
// force the unbind without resetting the value
310
263
unbind ( false )
311
264
const promise = new Promise ( ( resolve , reject ) => {
312
- bindCollection (
313
- { target, collection : other , resolve, reject, ops } ,
314
- { wait : true }
315
- )
265
+ bindCollection ( target , other , ops , resolve , reject , { wait : true } )
316
266
} )
317
267
expect ( target . value ) . toEqual ( [ ] )
318
268
await promise
0 commit comments