|
15 | 15 | */
|
16 | 16 |
|
17 | 17 | import { Query } from '../../../src/core/query';
|
18 |
| -import { doc, orderBy, path } from '../../util/helpers'; |
| 18 | +import {doc, filter, orderBy, path} from '../../util/helpers'; |
19 | 19 |
|
20 | 20 | import { describeSpec, specTest } from './describe_spec';
|
21 | 21 | import { spec } from './spec_builder';
|
@@ -242,5 +242,46 @@ describeSpec(
|
242 | 242 | return steps;
|
243 | 243 | }
|
244 | 244 | );
|
| 245 | + |
| 246 | + specTest('Process 25 target updates and wait for snapshot', [], () => { |
| 247 | + const queriesPerStep = 25; |
| 248 | + |
| 249 | + let currentVersion = 1; |
| 250 | + let steps = spec().withGCEnabled(false); |
| 251 | + |
| 252 | + for (let i = 1; i <= STEP_COUNT; ++i) { |
| 253 | + const collPath = `collection/${i}/coll`; |
| 254 | + const matchingDoc = doc(`${collPath}/${i}`, ++currentVersion, { |
| 255 | + val: -1 |
| 256 | + }); |
| 257 | + |
| 258 | + const queries = []; |
| 259 | + |
| 260 | + for (let j = 0; j < queriesPerStep; ++j) { |
| 261 | + const query = Query.atPath(path(collPath)).addFilter( |
| 262 | + filter('val', '<=', j) |
| 263 | + ); |
| 264 | + queries.push(query); |
| 265 | + steps = steps.userListens(query).watchAcks(query); |
| 266 | + } |
| 267 | + |
| 268 | + steps = steps |
| 269 | + .watchSends({affects: queries}, matchingDoc) |
| 270 | + .watchSnapshots(++currentVersion); |
| 271 | + |
| 272 | + for (const query of queries) { |
| 273 | + steps = steps.expectEvents(query, { |
| 274 | + added: [matchingDoc], |
| 275 | + fromCache: true |
| 276 | + }); |
| 277 | + } |
| 278 | + |
| 279 | + for (const query of queries) { |
| 280 | + steps = steps.userUnlistens(query).watchRemoves(query); |
| 281 | + } |
| 282 | + } |
| 283 | + |
| 284 | + return steps; |
| 285 | + }); |
245 | 286 | }
|
246 | 287 | );
|
0 commit comments