@@ -28,9 +28,9 @@ describeSpec(
28
28
[ 'benchmark' ] ,
29
29
( ) => {
30
30
specTest ( 'Insert a new document' , [ ] , ( ) => {
31
- let steps = spec ( ) . withGCEnabled ( false ) ;
31
+ const steps = spec ( ) . withGCEnabled ( false ) ;
32
32
for ( let i = 0 ; i < STEP_COUNT ; ++ i ) {
33
- steps = steps
33
+ steps
34
34
. userSets ( `collection/{i}` , { doc : i } )
35
35
. writeAcks ( `collection/{i}` , i ) ;
36
36
}
@@ -42,7 +42,7 @@ describeSpec(
42
42
[ ] ,
43
43
( ) => {
44
44
let currentVersion = 1 ;
45
- let steps = spec ( ) . withGCEnabled ( false ) ;
45
+ const steps = spec ( ) . withGCEnabled ( false ) ;
46
46
47
47
for ( let i = 0 ; i < STEP_COUNT ; ++ i ) {
48
48
const query = Query . atPath ( path ( `collection/${ i } ` ) ) ;
@@ -56,7 +56,7 @@ describeSpec(
56
56
doc : i
57
57
} ) ;
58
58
59
- steps = steps
59
+ steps
60
60
. userListens ( query )
61
61
. userSets ( `collection/${ i } ` , { doc : i } )
62
62
. expectEvents ( query , {
@@ -78,9 +78,7 @@ describeSpec(
78
78
const cachedDocumentCount = 100 ;
79
79
80
80
const query = Query . atPath ( path ( `collection` ) ) . addOrderBy ( orderBy ( 'v' ) ) ;
81
-
82
- let steps = spec ( ) . withGCEnabled ( false ) ;
83
-
81
+ const steps = spec ( ) . withGCEnabled ( false ) ;
84
82
const docs = [ ] ;
85
83
86
84
for ( let i = 0 ; i < cachedDocumentCount ; ++ i ) {
@@ -91,7 +89,7 @@ describeSpec(
91
89
}
92
90
93
91
for ( let i = 1 ; i <= STEP_COUNT ; ++ i ) {
94
- steps = steps
92
+ steps
95
93
. userListens ( query )
96
94
. expectEvents ( query , {
97
95
added : docs ,
@@ -105,10 +103,12 @@ describeSpec(
105
103
} ) ;
106
104
107
105
specTest ( 'Update a single document' , [ ] , ( ) => {
108
- let steps = spec ( ) . withGCEnabled ( false ) ;
109
- steps = steps . userSets ( `collection/doc` , { v : 0 } ) ;
106
+ const steps = spec ( )
107
+ . withGCEnabled ( false )
108
+ . userSets ( `collection/doc` , { v : 0 } ) ;
109
+
110
110
for ( let i = 1 ; i <= STEP_COUNT ; ++ i ) {
111
- steps = steps
111
+ steps
112
112
. userPatches ( `collection/doc` , { v : i } )
113
113
. writeAcks ( `collection/doc` , i ) ;
114
114
}
@@ -122,7 +122,7 @@ describeSpec(
122
122
const query = Query . atPath ( path ( `collection/doc` ) ) ;
123
123
124
124
let currentVersion = 1 ;
125
- let steps = spec ( ) . withGCEnabled ( false ) ;
125
+ const steps = spec ( ) . withGCEnabled ( false ) ;
126
126
127
127
let docLocal = doc (
128
128
`collection/doc` ,
@@ -133,7 +133,7 @@ describeSpec(
133
133
let docRemote = doc ( `collection/doc` , ++ currentVersion , { v : 0 } ) ;
134
134
let lastRemoteVersion = currentVersion ;
135
135
136
- steps = steps
136
+ steps
137
137
. userListens ( query )
138
138
. userSets ( `collection/doc` , { v : 0 } )
139
139
. expectEvents ( query , {
@@ -155,7 +155,7 @@ describeSpec(
155
155
docRemote = doc ( `collection/doc` , ++ currentVersion , { v : i } ) ;
156
156
lastRemoteVersion = currentVersion ;
157
157
158
- steps = steps
158
+ steps
159
159
. userPatches ( `collection/doc` , { v : i } )
160
160
. expectEvents ( query , {
161
161
modified : [ docLocal ] ,
@@ -177,11 +177,11 @@ describeSpec(
177
177
const documentsPerStep = 100 ;
178
178
179
179
const query = Query . atPath ( path ( `collection` ) ) . addOrderBy ( orderBy ( 'v' ) ) ;
180
+ const steps = spec ( ) . withGCEnabled ( false ) ;
180
181
181
182
let currentVersion = 1 ;
182
- let steps = spec ( ) . withGCEnabled ( false ) ;
183
183
184
- steps = steps
184
+ steps
185
185
. userListens ( query )
186
186
. watchAcksFull ( query , currentVersion )
187
187
. expectEvents ( query , { } ) ;
@@ -197,7 +197,7 @@ describeSpec(
197
197
198
198
const changeType = i === 1 ? 'added' : 'modified' ;
199
199
200
- steps = steps
200
+ steps
201
201
. watchSends ( { affects : [ query ] } , ...docs )
202
202
. watchSnapshots ( ++ currentVersion )
203
203
. expectEvents ( query , { [ changeType ] : docs } ) ;
@@ -214,7 +214,7 @@ describeSpec(
214
214
const documentsPerStep = 100 ;
215
215
216
216
let currentVersion = 1 ;
217
- let steps = spec ( ) . withGCEnabled ( false ) ;
217
+ const steps = spec ( ) . withGCEnabled ( false ) ;
218
218
219
219
for ( let i = 1 ; i <= STEP_COUNT ; ++ i ) {
220
220
const collPath = `collection/${ i } /coll` ;
@@ -225,7 +225,7 @@ describeSpec(
225
225
docs . push ( doc ( `${ collPath } /${ j } ` , ++ currentVersion , { v : j } ) ) ;
226
226
}
227
227
228
- steps = steps
228
+ steps
229
229
. userListens ( query )
230
230
. watchAcksFull ( query , ++ currentVersion , ...docs )
231
231
. expectEvents ( query , { added : docs } )
@@ -247,7 +247,7 @@ describeSpec(
247
247
const queriesPerStep = 25 ;
248
248
249
249
let currentVersion = 1 ;
250
- let steps = spec ( ) . withGCEnabled ( false ) ;
250
+ const steps = spec ( ) . withGCEnabled ( false ) ;
251
251
252
252
for ( let i = 1 ; i <= STEP_COUNT ; ++ i ) {
253
253
// We use a different subcollection for each iteration to ensure
@@ -266,24 +266,24 @@ describeSpec(
266
266
filter ( 'val' , '<=' , j )
267
267
) ;
268
268
queries . push ( query ) ;
269
- steps = steps . userListens ( query ) . watchAcks ( query ) ;
269
+ steps . userListens ( query ) . watchAcks ( query ) ;
270
270
}
271
271
272
- steps = steps
272
+ steps
273
273
. watchSends ( { affects : queries } , matchingDoc )
274
274
. watchSnapshots ( ++ currentVersion ) ;
275
275
276
276
// Registers the snapshot expectations with the spec runner.
277
277
for ( const query of queries ) {
278
- steps = steps . expectEvents ( query , {
278
+ steps . expectEvents ( query , {
279
279
added : [ matchingDoc ] ,
280
280
fromCache : true
281
281
} ) ;
282
282
}
283
283
284
284
// Unlisten and clean up the query.
285
285
for ( const query of queries ) {
286
- steps = steps . userUnlistens ( query ) . watchRemoves ( query ) ;
286
+ steps . userUnlistens ( query ) . watchRemoves ( query ) ;
287
287
}
288
288
}
289
289
0 commit comments