Files
firebase-ios-sdk/Firestore/Example/Tests/SpecTests/json/query_spec_test.json
T

1374 lines
31 KiB
JSON

{
"Collection Group query": {
"describeName": "Queries:",
"itName": "Collection Group query",
"tags": [],
"config": {
"useGarbageCollection": true,
"numClients": 1
},
"steps": [
{
"userListen": [
2,
{
"path": "cg/1",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
2
]
},
{
"watchEntity": {
"docs": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
2
]
}
},
{
"watchCurrent": [
[
2
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userListen": [
4,
{
"path": "cg/2",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
4
]
},
{
"watchEntity": {
"docs": [
{
"key": "cg/2",
"version": 1000,
"value": {
"val": 2
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
4
]
}
},
{
"watchCurrent": [
[
4
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "cg/2",
"version": 1000,
"value": {
"val": 2
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userListen": [
6,
{
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
6
]
},
{
"watchEntity": {
"docs": [
{
"key": "not-cg/nope/cg/3",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
6
]
}
},
{
"watchCurrent": [
[
6
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "not-cg/nope/cg/3",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userListen": [
8,
{
"path": "not-cg/nope",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"8": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
8
]
},
{
"watchEntity": {
"docs": [
{
"key": "not-cg/nope",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
8
]
}
},
{
"watchCurrent": [
[
8
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "not-cg/nope",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userListen": [
10,
{
"path": "cg/1/not-cg/nope",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"8": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"10": {
"query": {
"path": "cg/1/not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
10
]
},
{
"watchEntity": {
"docs": [
{
"key": "cg/1/not-cg/nope",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
10
]
}
},
{
"watchCurrent": [
[
10
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "cg/1/not-cg/nope",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "cg/1/not-cg/nope",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userListen": [
12,
{
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"8": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"10": {
"query": {
"path": "cg/1/not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"12": {
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
},
"expectedSnapshotEvents": [
{
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
},
{
"key": "cg/2",
"version": 1000,
"value": {
"val": 2
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
},
{
"key": "not-cg/nope/cg/3",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": true,
"hasPendingWrites": false
}
]
},
{
"userListen": [
14,
{
"path": "",
"collectionGroup": "cg",
"filters": [
[
"val",
"==",
1
]
],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "cg/2",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "not-cg/nope/cg/3",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"8": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"10": {
"query": {
"path": "cg/1/not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"12": {
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"14": {
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [
[
"val",
"==",
1
]
],
"orderBys": []
},
"resumeToken": ""
}
}
},
"expectedSnapshotEvents": [
{
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [
[
"val",
"==",
1
]
],
"orderBys": []
},
"added": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
},
{
"key": "not-cg/nope/cg/3",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": true,
"hasPendingWrites": false
}
]
}
]
},
"Collection Group query with mutations": {
"describeName": "Queries:",
"itName": "Collection Group query with mutations",
"tags": [],
"config": {
"useGarbageCollection": true,
"numClients": 1
},
"steps": [
{
"userListen": [
2,
{
"path": "cg/1",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
2
]
},
{
"watchEntity": {
"docs": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
2
]
}
},
{
"watchCurrent": [
[
2
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userListen": [
4,
{
"path": "not-cg/nope",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
4
]
},
{
"watchEntity": {
"docs": [
{
"key": "not-cg/nope",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
4
]
}
},
{
"watchCurrent": [
[
4
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "not-cg/nope",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userSet": [
"cg/2",
{
"val": 2
}
]
},
{
"userSet": [
"not-cg/nope/cg/3",
{
"val": 1
}
]
},
{
"userSet": [
"not-cg2/nope",
{
"val": 1
}
]
},
{
"userListen": [
6,
{
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
},
"expectedSnapshotEvents": [
{
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
},
{
"key": "cg/2",
"version": 0,
"value": {
"val": 2
},
"options": {
"hasLocalMutations": true,
"hasCommittedMutations": false
}
},
{
"key": "not-cg/nope/cg/3",
"version": 0,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": true,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": true,
"hasPendingWrites": true
}
]
},
{
"userListen": [
8,
{
"path": "",
"collectionGroup": "cg",
"filters": [
[
"val",
"==",
1
]
],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "cg/1",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "not-cg/nope",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"6": {
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"8": {
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [
[
"val",
"==",
1
]
],
"orderBys": []
},
"resumeToken": ""
}
}
},
"expectedSnapshotEvents": [
{
"query": {
"path": "",
"collectionGroup": "cg",
"filters": [
[
"val",
"==",
1
]
],
"orderBys": []
},
"added": [
{
"key": "cg/1",
"version": 1000,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
},
{
"key": "not-cg/nope/cg/3",
"version": 0,
"value": {
"val": 1
},
"options": {
"hasLocalMutations": true,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": true,
"hasPendingWrites": true
}
]
}
]
},
"Latency-compensated updates are included in query results": {
"describeName": "Queries:",
"itName": "Latency-compensated updates are included in query results",
"tags": [],
"config": {
"useGarbageCollection": true,
"numClients": 1
},
"steps": [
{
"userListen": [
2,
{
"path": "collection",
"filters": [],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "collection",
"filters": [],
"orderBys": []
},
"resumeToken": ""
}
}
}
},
{
"watchAck": [
2
]
},
{
"watchEntity": {
"docs": [
{
"key": "collection/a",
"version": 1000,
"value": {
"match": false
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"targets": [
2
]
}
},
{
"watchCurrent": [
[
2
],
"resume-token-1000"
]
},
{
"watchSnapshot": {
"version": 1000,
"targetIds": []
},
"expectedSnapshotEvents": [
{
"query": {
"path": "collection",
"filters": [],
"orderBys": []
},
"added": [
{
"key": "collection/a",
"version": 1000,
"value": {
"match": false
},
"options": {
"hasLocalMutations": false,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": false
}
]
},
{
"userPatch": [
"collection/a",
{
"match": true
}
],
"expectedSnapshotEvents": [
{
"query": {
"path": "collection",
"filters": [],
"orderBys": []
},
"modified": [
{
"key": "collection/a",
"version": 1000,
"value": {
"match": true
},
"options": {
"hasLocalMutations": true,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": false,
"hasPendingWrites": true
}
]
},
{
"userListen": [
4,
{
"path": "collection",
"filters": [
[
"match",
"==",
true
]
],
"orderBys": []
}
],
"expectedState": {
"activeTargets": {
"2": {
"query": {
"path": "collection",
"filters": [],
"orderBys": []
},
"resumeToken": ""
},
"4": {
"query": {
"path": "collection",
"filters": [
[
"match",
"==",
true
]
],
"orderBys": []
},
"resumeToken": ""
}
}
},
"expectedSnapshotEvents": [
{
"query": {
"path": "collection",
"filters": [
[
"match",
"==",
true
]
],
"orderBys": []
},
"added": [
{
"key": "collection/a",
"version": 1000,
"value": {
"match": true
},
"options": {
"hasLocalMutations": true,
"hasCommittedMutations": false
}
}
],
"errorCode": 0,
"fromCache": true,
"hasPendingWrites": true
}
]
}
]
}
}