Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions firestore/tests/unit/testdata/create-all-transforms.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# A document can be created with any amount of transforms.

description: "create: all transforms in a single call"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": 1, \"b\": \"ServerTimestamp\", \"c\": [\"ArrayUnion\", 1, 2, 3], \"d\": [\"ArrayRemove\", 4, 5, 6]}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
integer_value: 1
>
>
>
current_document: <
exists: false
>
>
writes: <
transform: <
document: "projects/projectID/databases/(default)/documents/C/d"
field_transforms: <
field_path: "b"
set_to_server_value: REQUEST_TIME
>
field_transforms: <
field_path: "c"
append_missing_elements: <
values: <
integer_value: 1
>
values: <
integer_value: 2
>
values: <
integer_value: 3
>
>
>
field_transforms: <
field_path: "d"
remove_all_from_array: <
values: <
integer_value: 4
>
values: <
integer_value: 5
>
values: <
integer_value: 6
>
>
>
>
>
>
>
61 changes: 61 additions & 0 deletions firestore/tests/unit/testdata/create-arrayremove-multi.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# A document can have more than one ArrayRemove field. Since all the ArrayRemove
# fields are removed, the only field in the update is "a".

description: "create: multiple ArrayRemove fields"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3], \"c\": {\"d\": [\"ArrayRemove\", 4, 5, 6]}}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
integer_value: 1
>
>
>
current_document: <
exists: false
>
>
writes: <
transform: <
document: "projects/projectID/databases/(default)/documents/C/d"
field_transforms: <
field_path: "b"
remove_all_from_array: <
values: <
integer_value: 1
>
values: <
integer_value: 2
>
values: <
integer_value: 3
>
>
>
field_transforms: <
field_path: "c.d"
remove_all_from_array: <
values: <
integer_value: 4
>
values: <
integer_value: 5
>
values: <
integer_value: 6
>
>
>
>
>
>
>
48 changes: 48 additions & 0 deletions firestore/tests/unit/testdata/create-arrayremove-nested.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# An ArrayRemove value can occur at any depth. In this case, the transform applies
# to the field path "b.c". Since "c" is removed from the update, "b" becomes
# empty, so it is also removed from the update.

description: "create: nested ArrayRemove field"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayRemove\", 1, 2, 3]}}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
integer_value: 1
>
>
>
current_document: <
exists: false
>
>
writes: <
transform: <
document: "projects/projectID/databases/(default)/documents/C/d"
field_transforms: <
field_path: "b.c"
remove_all_from_array: <
values: <
integer_value: 1
>
values: <
integer_value: 2
>
values: <
integer_value: 3
>
>
>
>
>
>
>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# There cannot be an array value anywhere on the path from the document root to
# the ArrayRemove. Firestore transforms don't support array indexing.

description: "create: ArrayRemove cannot be anywhere inside an array value"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": [1, {\"b\": [\"ArrayRemove\", 1, 2, 3]}]}"
is_error: true
>
12 changes: 12 additions & 0 deletions firestore/tests/unit/testdata/create-arrayremove-noarray.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# ArrayRemove must be the value of a field. Firestore transforms don't support
# array indexing.

description: "create: ArrayRemove cannot be in an array value"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}"
is_error: true
>
12 changes: 12 additions & 0 deletions firestore/tests/unit/testdata/create-arrayremove-with-st.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# The ServerTimestamp sentinel must be the value of a field. It may not appear in
# an ArrayUnion.

description: "create: The ServerTimestamp sentinel cannot be in an ArrayUnion"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": [\"ArrayRemove\", 1, \"ServerTimestamp\", 3]}"
is_error: true
>
47 changes: 47 additions & 0 deletions firestore/tests/unit/testdata/create-arrayremove.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# A key with ArrayRemove is removed from the data in the update operation. Instead
# it appears in a separate Transform operation.

description: "create: ArrayRemove with data"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": 1, \"b\": [\"ArrayRemove\", 1, 2, 3]}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
integer_value: 1
>
>
>
current_document: <
exists: false
>
>
writes: <
transform: <
document: "projects/projectID/databases/(default)/documents/C/d"
field_transforms: <
field_path: "b"
remove_all_from_array: <
values: <
integer_value: 1
>
values: <
integer_value: 2
>
values: <
integer_value: 3
>
>
>
>
>
>
>
61 changes: 61 additions & 0 deletions firestore/tests/unit/testdata/create-arrayunion-multi.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# A document can have more than one ArrayUnion field. Since all the ArrayUnion
# fields are removed, the only field in the update is "a".

description: "create: multiple ArrayUnion fields"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": 1, \"b\": [\"ArrayUnion\", 1, 2, 3], \"c\": {\"d\": [\"ArrayUnion\", 4, 5, 6]}}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
integer_value: 1
>
>
>
current_document: <
exists: false
>
>
writes: <
transform: <
document: "projects/projectID/databases/(default)/documents/C/d"
field_transforms: <
field_path: "b"
append_missing_elements: <
values: <
integer_value: 1
>
values: <
integer_value: 2
>
values: <
integer_value: 3
>
>
>
field_transforms: <
field_path: "c.d"
append_missing_elements: <
values: <
integer_value: 4
>
values: <
integer_value: 5
>
values: <
integer_value: 6
>
>
>
>
>
>
>
48 changes: 48 additions & 0 deletions firestore/tests/unit/testdata/create-arrayunion-nested.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# An ArrayUnion value can occur at any depth. In this case, the transform applies
# to the field path "b.c". Since "c" is removed from the update, "b" becomes
# empty, so it is also removed from the update.

description: "create: nested ArrayUnion field"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": 1, \"b\": {\"c\": [\"ArrayUnion\", 1, 2, 3]}}"
request: <
database: "projects/projectID/databases/(default)"
writes: <
update: <
name: "projects/projectID/databases/(default)/documents/C/d"
fields: <
key: "a"
value: <
integer_value: 1
>
>
>
current_document: <
exists: false
>
>
writes: <
transform: <
document: "projects/projectID/databases/(default)/documents/C/d"
field_transforms: <
field_path: "b.c"
append_missing_elements: <
values: <
integer_value: 1
>
values: <
integer_value: 2
>
values: <
integer_value: 3
>
>
>
>
>
>
>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# There cannot be an array value anywhere on the path from the document root to
# the ArrayUnion. Firestore transforms don't support array indexing.

description: "create: ArrayUnion cannot be anywhere inside an array value"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": [1, {\"b\": [\"ArrayUnion\", 1, 2, 3]}]}"
is_error: true
>
12 changes: 12 additions & 0 deletions firestore/tests/unit/testdata/create-arrayunion-noarray.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# DO NOT MODIFY. This file was generated by
# github.com/GoogleCloudPlatform/google-cloud-common/testing/firestore/cmd/generate-firestore-tests/generate-firestore-tests.go.

# ArrayUnion must be the value of a field. Firestore transforms don't support
# array indexing.

description: "create: ArrayUnion cannot be in an array value"
create: <
doc_ref_path: "projects/projectID/databases/(default)/documents/C/d"
json_data: "{\"a\": [1, 2, [\"ArrayRemove\", 1, 2, 3]]}"
is_error: true
>
Loading