-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add more integration tests for expressions that require escapin…
…g field names (#114) I wanted to make another pass on test coverage for the recent changes I made, especially to `make_selector.rs`.
- Loading branch information
Showing
10 changed files
with
193 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...s/integration_tests__tests__expressions__evaluates_field_name_that_requires_escaping.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/expressions.rs | ||
expression: "graphql_query(r#\"\n query {\n testCases_weirdFieldNames(where: { invalidName: { _eq: 3 } }) {\n invalidName\n }\n }\n \"#).run().await?" | ||
--- | ||
data: | ||
testCases_weirdFieldNames: | ||
- invalidName: 3 | ||
errors: ~ |
8 changes: 8 additions & 0 deletions
8
...ests__expressions__evaluates_field_name_that_requires_escaping_in_complex_expression.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/expressions.rs | ||
expression: "graphql_query(r#\"\n query {\n testCases_weirdFieldNames(\n where: { \n _and: [\n { invalidName: { _gt: 2 } },\n { invalidName: { _lt: 4 } } \n ] \n }\n ) {\n invalidName\n }\n }\n \"#).run().await?" | ||
--- | ||
data: | ||
testCases_weirdFieldNames: | ||
- invalidName: 3 | ||
errors: ~ |
9 changes: 0 additions & 9 deletions
9
...tests__expressions__evaluates_field_name_that_requires_escaping_in_nested_expression.snap
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
...integration_tests__tests__expressions__exists_in_nested_collection_without_predicate.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/expressions.rs | ||
expression: "run_connector_query(Connector::TestCases,\n query_request().collection(\"nested_collection\").query(query().predicate(Expression::Exists {\n in_collection: ExistsInCollection::NestedCollection {\n column_name: \"staff\".into(),\n arguments: Default::default(),\n field_path: Default::default(),\n },\n predicate: None,\n }).fields([field!(\"_id\"),\n field!(\"institution\")]).order_by([asc!(\"institution\")]))).await?" | ||
--- | ||
- rows: | ||
- _id: 6705a1cec2df58ace3e67807 | ||
institution: Aperture Science | ||
- _id: 6705a1c2c2df58ace3e67806 | ||
institution: Black Mesa | ||
- _id: 6705a1d7c2df58ace3e67808 | ||
institution: City 17 |
17 changes: 17 additions & 0 deletions
17
...__expressions__exists_in_nested_collection_without_predicate_with_escaped_field_name.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/expressions.rs | ||
expression: "run_connector_query(Connector::TestCases,\n query_request().collection(\"weird_field_names\").query(query().predicate(Expression::Exists {\n in_collection: ExistsInCollection::NestedCollection {\n column_name: \"$invalid.array\".into(),\n arguments: Default::default(),\n field_path: Default::default(),\n },\n predicate: None,\n }).fields([field!(\"_id\"),\n field!(\"invalid_array\" => \"$invalid.array\",\n array!(object!([field!(\"invalid_element\" =>\n \"$invalid.element\")])))]).order_by([asc!(\"$invalid.name\")]))).await?" | ||
--- | ||
- rows: | ||
- _id: 66cf91a0ec1dfb55954378bd | ||
invalid_array: | ||
- invalid_element: 1 | ||
- _id: 66cf9230ec1dfb55954378be | ||
invalid_array: | ||
- invalid_element: 2 | ||
- _id: 66cf9274ec1dfb55954378bf | ||
invalid_array: | ||
- invalid_element: 3 | ||
- _id: 66cf9295ec1dfb55954378c0 | ||
invalid_array: | ||
- invalid_element: 4 |
11 changes: 11 additions & 0 deletions
11
...integration_tests__tests__expressions__exists_with_predicate_with_escaped_field_name.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
source: crates/integration-tests/src/tests/expressions.rs | ||
expression: "run_connector_query(Connector::TestCases,\n query_request().collection(\"weird_field_names\").query(query().predicate(exists(ExistsInCollection::NestedCollection {\n column_name: \"$invalid.array\".into(),\n arguments: Default::default(),\n field_path: Default::default(),\n },\n binop(\"_lt\", target!(\"$invalid.element\"),\n value!(3)))).fields([field!(\"_id\"),\n field!(\"invalid_array\" => \"$invalid.array\",\n array!(object!([field!(\"invalid_element\" =>\n \"$invalid.element\")])))]).order_by([asc!(\"$invalid.name\")]))).await?" | ||
--- | ||
- rows: | ||
- _id: 66cf91a0ec1dfb55954378bd | ||
invalid_array: | ||
- invalid_element: 1 | ||
- _id: 66cf9230ec1dfb55954378be | ||
invalid_array: | ||
- invalid_element: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ "institution": "Black Mesa", "staff": [{ "name": "Freeman" }, { "name": "Calhoun" }] } | ||
{ "institution": "Aperture Science", "staff": [{ "name": "GLaDOS" }, { "name": "Chell" }] } | ||
{ "institution": "City 17", "staff": [{ "name": "Alyx" }, { "name": "Freeman" }, { "name": "Breen" }] } | ||
{ "_id": { "$oid": "6705a1c2c2df58ace3e67806" }, "institution": "Black Mesa", "staff": [{ "name": "Freeman" }, { "name": "Calhoun" }] } | ||
{ "_id": { "$oid": "6705a1cec2df58ace3e67807" }, "institution": "Aperture Science", "staff": [{ "name": "GLaDOS" }, { "name": "Chell" }] } | ||
{ "_id": { "$oid": "6705a1d7c2df58ace3e67808" }, "institution": "City 17", "staff": [{ "name": "Alyx" }, { "name": "Freeman" }, { "name": "Breen" }] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ "_id": { "$oid": "66cf91a0ec1dfb55954378bd" }, "$invalid.name": 1, "$invalid.object.name": { "valid_name": 1 }, "valid_object_name": { "$invalid.nested.name": 1 } } | ||
{ "_id": { "$oid": "66cf9230ec1dfb55954378be" }, "$invalid.name": 2, "$invalid.object.name": { "valid_name": 2 }, "valid_object_name": { "$invalid.nested.name": 2 } } | ||
{ "_id": { "$oid": "66cf9274ec1dfb55954378bf" }, "$invalid.name": 3, "$invalid.object.name": { "valid_name": 3 }, "valid_object_name": { "$invalid.nested.name": 3 } } | ||
{ "_id": { "$oid": "66cf9295ec1dfb55954378c0" }, "$invalid.name": 4, "$invalid.object.name": { "valid_name": 4 }, "valid_object_name": { "$invalid.nested.name": 4 } } | ||
{ "_id": { "$oid": "66cf91a0ec1dfb55954378bd" }, "$invalid.name": 1, "$invalid.object.name": { "valid_name": 1 }, "valid_object_name": { "$invalid.nested.name": 1 }, "$invalid.array": [{ "$invalid.element": 1 }] } | ||
{ "_id": { "$oid": "66cf9230ec1dfb55954378be" }, "$invalid.name": 2, "$invalid.object.name": { "valid_name": 2 }, "valid_object_name": { "$invalid.nested.name": 2 }, "$invalid.array": [{ "$invalid.element": 2 }] } | ||
{ "_id": { "$oid": "66cf9274ec1dfb55954378bf" }, "$invalid.name": 3, "$invalid.object.name": { "valid_name": 3 }, "valid_object_name": { "$invalid.nested.name": 3 }, "$invalid.array": [{ "$invalid.element": 3 }] } | ||
{ "_id": { "$oid": "66cf9295ec1dfb55954378c0" }, "$invalid.name": 4, "$invalid.object.name": { "valid_name": 4 }, "valid_object_name": { "$invalid.nested.name": 4 }, "$invalid.array": [{ "$invalid.element": 4 }] } |