{ "Contents of query are cleared when listen is removed.": { "describeName": "Listens:", "itName": "Contents of query are cleared when listen is removed.", "tags": [ "no-lru" ], "comment": "Explicitly tests eager GC behavior", "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "userListen": [ 4, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "4": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } } ] }, "Contents of query update when new data is received.": { "describeName": "Listens:", "itName": "Contents of query update when new data is received.", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchEntity": { "docs": [ [ "collection/b", 2000, { "key": "b" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/b", 2000, { "key": "b" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Doesn't raise events for empty target": { "describeName": "Listens:", "itName": "Doesn't raise events for empty target", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection1", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "userListen": [ 4, { "path": "collection2", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "resumeToken": "" }, "4": { "query": { "path": "collection2", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "userListen": [ 6, { "path": "collection3", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "resumeToken": "" }, "4": { "query": { "path": "collection2", "filters": [], "orderBys": [] }, "resumeToken": "" }, "6": { "query": { "path": "collection3", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchAck": [ 4 ] }, { "watchEntity": { "docs": [ [ "collection2/a", 1000, { "key": "a" } ] ], "targets": [ 4 ] } }, { "watchAck": [ 6 ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false }, { "query": { "path": "collection2", "filters": [], "orderBys": [] }, "added": [ [ "collection2/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] } ] }, "Ensure correct query results with latency-compensated deletes": { "describeName": "Listens:", "itName": "Ensure correct query results with latency-compensated deletes", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userDelete": "collection/b" }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "a": true } ], [ "collection/b", 1000, { "b": true } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "a": true } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userListen": [ 4, { "path": "collection", "limit": 10, "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" }, "4": { "query": { "path": "collection", "limit": 10, "filters": [], "orderBys": [] }, "resumeToken": "" } } }, "expect": [ { "query": { "path": "collection", "limit": 10, "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "a": true } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] } ] }, "Does not raise event for initial document delete": { "describeName": "Listens:", "itName": "Does not raise event for initial document delete", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, null ] ], "removedTargets": [ 2 ] } }, { "watchSnapshot": { "version": 1000 } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ] }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Will process removals without waiting for a consistent snapshot": { "describeName": "Listens:", "itName": "Will process removals without waiting for a consistent snapshot", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchRemove": { "targetIds": [ 2 ], "cause": { "code": 8 } }, "stateExpect": { "activeTargets": {} }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 8, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Will gracefully process failed targets": { "describeName": "Listens:", "itName": "Will gracefully process failed targets", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection1", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "userListen": [ 4, { "path": "collection2", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "resumeToken": "" }, "4": { "query": { "path": "collection2", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchAck": [ 4 ] }, { "watchEntity": { "docs": [ [ "collection1/a", 1000, { "a": true } ] ], "targets": [ 2 ] } }, { "watchEntity": { "docs": [ [ "collection2/a", 1001, { "b": true } ] ], "targets": [ 4 ] } }, { "watchRemove": { "targetIds": [ 2 ], "cause": { "code": 8 } }, "stateExpect": { "activeTargets": { "4": { "query": { "path": "collection2", "filters": [], "orderBys": [] }, "resumeToken": "" } } }, "expect": [ { "query": { "path": "collection1", "filters": [], "orderBys": [] }, "errorCode": 8, "fromCache": false, "hasPendingWrites": false } ] }, { "watchCurrent": [ [ 4 ], "resume-token-2000" ] }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection2", "filters": [], "orderBys": [] }, "added": [ [ "collection2/a", 1001, { "b": true } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Will gracefully handle watch stream reverting snapshots": { "describeName": "Listens:", "itName": "Will gracefully handle watch stream reverting snapshots", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "v": "v1000" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "v": "v1000" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchEntity": { "docs": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "modified": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "v": "v1000" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 } }, { "watchEntity": { "docs": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Will gracefully handle watch stream reverting snapshots (with restart)": { "describeName": "Listens:", "itName": "Will gracefully handle watch stream reverting snapshots (with restart)", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "v": "v1000" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "v": "v1000" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchEntity": { "docs": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "modified": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "restart": true, "stateExpect": { "activeTargets": {}, "limboDocs": [] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "v": "v1000" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 } }, { "watchEntity": { "docs": [ [ "collection/a", 2000, { "v": "v2000" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Individual documents cannot revert": { "describeName": "Listens:", "itName": "Individual documents cannot revert", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "v": "v1000", "visible": true } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "v": "v1000", "visible": true } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 4, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "4": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "v": "v1000", "visible": true } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 4 ] }, { "watchEntity": { "docs": [ [ "collection/a", 3000, { "v": "v3000", "visible": false } ] ], "targets": [ 4 ] } }, { "watchCurrent": [ [ 4 ], "resume-token-4000" ] }, { "watchSnapshot": { "version": 4000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "modified": [ [ "collection/a", 3000, { "v": "v3000", "visible": false } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 4, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 4 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] }, "resumeToken": "resume-token-1000" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 2000, { "v": "v2000", "visible": false } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-5000" ] }, { "watchSnapshot": { "version": 5000 }, "expect": [ { "query": { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [ [ "visible", "==", true ] ], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 4, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "4": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-4000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 3000, { "v": "v3000", "visible": false } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 4 ] }, { "watchEntity": { "docs": [], "targets": [ 4 ] } }, { "watchCurrent": [ [ 4 ], "resume-token-6000" ] }, { "watchSnapshot": { "version": 6000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Listens are reestablished after network disconnect": { "describeName": "Listens:", "itName": "Listens are reestablished after network disconnect", "tags": [], "config": { "useGarbageCollection": true }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } }, "watchStreamRequestCount": 1 } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "enableNetwork": false, "stateExpect": { "activeTargets": {}, "limboDocs": [] }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "enableNetwork": true, "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } }, "watchStreamRequestCount": 2 } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/b", 2000, { "key": "b" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ] }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/b", 2000, { "key": "b" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Synthesizes deletes for missing document": { "describeName": "Listens:", "itName": "Synthesizes deletes for missing document", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ], [ "collection/b", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ], [ "collection/b", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ], [ "collection/b", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "userListen": [ 4, { "path": "collection/a", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "4": { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "resumeToken": "" } } }, "expect": [ { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 4 ] }, { "watchCurrent": [ [ 4 ], "resume-token-2000" ] }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "removed": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 4, { "path": "collection/a", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 4 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/b", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] } ] }, "Re-opens target without existence filter": { "describeName": "Listens:", "itName": "Re-opens target without existence filter", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 2000, null ] ], "removedTargets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ] }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "removed": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] }, "Ignores update from inactive target": { "describeName": "Listens:", "itName": "Ignores update from inactive target", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchEntity": { "docs": [ [ "collection/b", 2000, { "key": "b" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000 } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-1000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] } ] }, "Does not synthesize deletes for previously acked documents": { "describeName": "Listens:", "itName": "Does not synthesize deletes for previously acked documents", "tags": [], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection/a", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ [ "collection/a", 1000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchCurrent": [ [ 2 ], "resume-token-2000" ] }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection/a", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "userListen": [ 2, { "path": "collection/a", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-2000" } } }, "expect": [ { "query": { "path": "collection/a", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 1000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] } ] }, "Persists resume token sent with target": { "describeName": "Listens:", "itName": "Persists resume token sent with target", "tags": [ "exclusive" ], "config": { "useGarbageCollection": false }, "steps": [ { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "version": 1000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "watchEntity": { "docs": [ [ "collection/a", 2000, { "key": "a" } ] ], "targets": [ 2 ] } }, { "watchSnapshot": { "version": 2000, "targetIds": [ 2 ], "resumeToken": "resume-token-2000" } }, { "watchSnapshot": { "version": 2000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 2000, { "key": "a" } ] ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] }, { "userUnlisten": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": {} } }, { "watchRemove": { "targetIds": [ 2 ] } }, { "userListen": [ 2, { "path": "collection", "filters": [], "orderBys": [] } ], "stateExpect": { "activeTargets": { "2": { "query": { "path": "collection", "filters": [], "orderBys": [] }, "resumeToken": "resume-token-2000" } } }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "added": [ [ "collection/a", 2000, { "key": "a" } ] ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false } ] }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-3000" ] }, { "watchSnapshot": { "version": 3000 }, "expect": [ { "query": { "path": "collection", "filters": [], "orderBys": [] }, "errorCode": 0, "fromCache": false, "hasPendingWrites": false } ] } ] } }