{ "orderBy applies filtering based on local state": { "describeName": "OrderBy:", "itName": "orderBy applies filtering based on local state", "tags": [ ], "config": { "numClients": 1, "useGarbageCollection": true }, "steps": [ { "userSet": [ "collection/a", { "key": "a", "sort": 1 } ] }, { "userPatch": [ "collection/b", { "sort": 2 } ] }, { "userSet": [ "collection/c", { "key": "b" } ] }, { "userListen": { "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" }, "targetId": 2 }, "expectedSnapshotEvents": [ { "added": [ { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "key": "a", "sort": 1 }, "version": 0 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": true, "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } } ], "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } ], "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ { "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "b" }, "version": 1001 } ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 2000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "key": "b", "sort": 2 }, "version": 1001 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": true, "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } } ] } ] }, "orderBy applies to existing documents": { "describeName": "OrderBy:", "itName": "orderBy applies to existing documents", "tags": [ ], "config": { "numClients": 1, "useGarbageCollection": false }, "steps": [ { "userListen": { "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" }, "targetId": 2 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } ], "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "a", "sort": 2 }, "version": 1000 }, { "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "b", "sort": 1 }, "version": 1001 } ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1002" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1002 }, "expectedSnapshotEvents": [ { "added": [ { "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "b", "sort": 1 }, "version": 1001 }, { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "a", "sort": 2 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } } ] }, { "userUnlisten": [ 2, { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } ], "expectedState": { "activeTargets": { } } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": { "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" }, "targetId": 2 }, "expectedSnapshotEvents": [ { "added": [ { "key": "collection/b", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "b", "sort": 1 }, "version": 1001 }, { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "key": "a", "sort": 2 }, "version": 1000 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } } ], "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } ], "resumeToken": "resume-token-1002" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1002" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1002 }, "expectedSnapshotEvents": [ { "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ [ "sort", "asc" ] ], "path": "collection" } } ] } ] } }