Skip to content

Commit

Permalink
test: add tests for update with exists=false precondition (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
dconeybe authored Jan 23, 2024
1 parent 3de4678 commit 76305a9
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
16 changes: 16 additions & 0 deletions firestore/v1/update-exists-false-precond.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"tests": [
{
"description": "update: Exists=false precondition is invalid",
"comment": "The Update method does not support an explicit exists=false precondition.",
"update": {
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
"precondition": {
"exists": false
},
"jsonData": "{\"a\": 1}",
"isError": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"tests": [
{
"description": "update: Exists precondition is valid",
"comment": "The Update method supports an explicit exists precondition.",
"description": "update: Exists=true precondition is valid",
"comment": "The Update method supports an explicit exists=true precondition.",
"update": {
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
"precondition": {
Expand Down
25 changes: 25 additions & 0 deletions firestore/v1/update-paths-exists-false-precond.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"tests": [
{
"description": "update-paths: Exists=false precondition is invalid",
"comment": "The Update method does not support an explicit exists=false precondition.",
"updatePaths": {
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
"precondition": {
"exists": false
},
"fieldPaths": [
{
"field": [
"a"
]
}
],
"jsonValues": [
"1"
],
"isError": true
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"tests": [
{
"description": "update-paths: Exists precondition is valid",
"comment": "The Update method supports an explicit exists precondition.",
"description": "update-paths: Exists=true precondition is valid",
"comment": "The Update method supports an explicit exists=true precondition.",
"updatePaths": {
"docRefPath": "projects/projectID/databases/(default)/documents/C/d",
"precondition": {
Expand Down

0 comments on commit 76305a9

Please sign in to comment.