-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✅ Add test for arg with default value in GraphQL field to aggregation…
… mapping
- Loading branch information
Showing
2 changed files
with
84 additions
and
8 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
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 |
---|---|---|
|
@@ -27,7 +27,7 @@ Scenario: Should return an array with two objects | |
userByEmail(email: "[email protected]"){ | ||
name | ||
postsByCategory | ||
postsGroupedByCategory | ||
} | ||
} | ||
""" | ||
|
@@ -37,7 +37,7 @@ Scenario: Should return an array with two objects | |
And request query | ||
When method POST | ||
Then status 200 | ||
And match $..postsByCategory.length() == 2 | ||
And match $..postsGroupedByCategory.length() == 2 | ||
|
||
|
||
Scenario: Should return an empty array for emptyStage field | ||
|
@@ -94,7 +94,7 @@ Scenario: Get a list of posts by category and for each one return the author nam | |
* text query = | ||
""" | ||
{ | ||
postsByCategory(category: "backend") { | ||
postsGroupedByCategory(category: backend) { | ||
author { | ||
name, | ||
postsByCategoryWithDataLoader | ||
|
@@ -109,8 +109,70 @@ Scenario: Get a list of posts by category and for each one return the author nam | |
When method POST | ||
Then status 200 | ||
|
||
Scenario: Get users with all posts in backend category | ||
* text query = | ||
""" | ||
{ | ||
userByEmail(email: "[email protected]"){ | ||
name | ||
postsByCategory(category: backend) { | ||
body | ||
} | ||
} | ||
} | ||
""" | ||
|
||
Given header Content-Type = contTypeGraphQL | ||
And header Authorization = admin | ||
And request query | ||
When method POST | ||
Then status 200 | ||
And match $.data.userByEmail.postsByCategory.length() == 2 | ||
|
||
Scenario: Get users with all posts in frontend category | ||
* text query = | ||
""" | ||
{ | ||
userByEmail(email: "[email protected]"){ | ||
name | ||
postsByCategory(category: frontend) { | ||
body | ||
} | ||
} | ||
} | ||
""" | ||
|
||
Given header Content-Type = contTypeGraphQL | ||
And header Authorization = admin | ||
And request query | ||
When method POST | ||
Then status 200 | ||
And match $.data.userByEmail.postsByCategory.length() == 1 | ||
|
||
Scenario: Get users with all posts in the default category (backend). this uses arg with default value | ||
* text query = | ||
""" | ||
{ | ||
userByEmail(email: "[email protected]"){ | ||
name | ||
postsByCategory { | ||
body | ||
} | ||
} | ||
} | ||
""" | ||
|
||
Given header Content-Type = contTypeGraphQL | ||
And header Authorization = admin | ||
And request query | ||
When method POST | ||
Then status 200 | ||
And match $.data.userByEmail.postsByCategory.length() == 2 | ||
|
||
Scenario: Map query field to aggregation to count the number of posts by category | ||
Scenario: Map query field to aggregation to count the number of posts by category | ||
* text query = | ||
""" | ||
{ | ||
|
@@ -125,4 +187,4 @@ Scenario: Map query field to aggregation to count the number of posts by categor | |
And header Authorization = admin | ||
And request query | ||
When method POST | ||
Then status 200 | ||
Then status 200 |