Skip to content

Commit

Permalink
tests: Reverse position on explicit "must exist" for update
Browse files Browse the repository at this point in the history
  • Loading branch information
jskeet committed Jan 18, 2024
1 parent 3264aa6 commit 3de4678
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 6 deletions.
28 changes: 25 additions & 3 deletions firestore/v1/update-exists-precond.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,37 @@
{
"tests": [
{
"description": "update: Exists precondition is invalid",
"comment": "The Update method does not support an explicit exists precondition.",
"description": "update: Exists precondition is valid",
"comment": "The Update method supports an explicit exists precondition.",
"update": {
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
"precondition": {
"exists": true
},
"jsonData": "{\"a\": 1}",
"isError": true
"request": {
"database": "projects/projectID/databases/(default)",
"writes": [
{
"update": {
"name": "projects/projectID/databases/(default)/documents/C/d",
"fields": {
"a": {
"integerValue": "1"
}
}
},
"updateMask": {
"fieldPaths": [
"a"
]
},
"currentDocument": {
"exists": true
}
}
]
}
}
}
]
Expand Down
28 changes: 25 additions & 3 deletions firestore/v1/update-paths-exists-precond.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"tests": [
{
"description": "update-paths: Exists precondition is invalid",
"comment": "The Update method does not support an explicit exists precondition.",
"description": "update-paths: Exists precondition is valid",
"comment": "The Update method supports an explicit exists precondition.",
"updatePaths": {
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
"precondition": {
Expand All @@ -18,7 +18,29 @@
"jsonValues": [
"1"
],
"isError": true
"request": {
"database": "projects/projectID/databases/(default)",
"writes": [
{
"update": {
"name": "projects/projectID/databases/(default)/documents/C/d",
"fields": {
"a": {
"integerValue": "1"
}
}
},
"updateMask": {
"fieldPaths": [
"a"
]
},
"currentDocument": {
"exists": true
}
}
]
}
}
}
]
Expand Down

0 comments on commit 3de4678

Please sign in to comment.