Skip to content

Commit

Permalink
https://github.com/api-platform/core/pull/5709
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilvestre committed Nov 8, 2023
1 parent 81365b9 commit c8eb47c
Showing 1 changed file with 15 additions and 84 deletions.
99 changes: 15 additions & 84 deletions features/hal/max_depth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,79 +19,33 @@ Feature: Max depth handling
Then the response status code should be 201
And the response should be in JSON
And the header "Content-Type" should be equal to "application/hal+json; charset=utf-8"
And the JSON should be equal to:
"""
{
"_links": {
"self": {
"href": "/max_depth_eager_dummies/1"
},
"child": {
"href": "/max_depth_eager_dummies/2"
}
},
"_embedded": {
"child": {
"_links": {
"self": {
"href": "/max_depth_eager_dummies/2"
}
},
"id": 2,
"name": "level 2"
}
},
"id": 1,
"name": "level 1"
}
"""
Then the JSON node "_embedded" should exist
Then the JSON node "_embedded.child" should exist
Then the JSON node "_embedded.child._embedded" should not exist

Scenario: Add a 2nd level of descendants
Scenario: Create a resource with 2 levels of descendants
When I add "Accept" header equal to "application/hal+json"
And I add "Content-Type" header equal to "application/json"
And I send a "PUT" request to "max_depth_eager_dummies/1" with body:
And I send a "POST" request to "/max_depth_eager_dummies" with body:
"""
{
"id": "/max_depth_eager_dummies/1",
"name": "level 1",
"child": {
"id": "/max_depth_eager_dummies/2",
"name": "level 2",
"child": {
"name": "level 3"
}
}
}
"""
And the response status code should be 200
And the response status code should be 201
And the response should be in JSON
And the header "Content-Type" should be equal to "application/hal+json; charset=utf-8"
And the JSON should be equal to:
"""
{
"_links": {
"self": {
"href": "/max_depth_eager_dummies/1"
},
"child": {
"href": "/max_depth_eager_dummies/2"
}
},
"_embedded": {
"child": {
"_links": {
"self": {
"href": "/max_depth_eager_dummies/2"
}
},
"id": 2,
"name": "level 2"
}
},
"id": 1,
"name": "level 1"
}
"""
Then the JSON node "_embedded" should exist
Then the JSON node "_embedded.child" should exist
Then the JSON node "_embedded.child._embedded" should not exist

Scenario: Add a 2nd level of descendants when eager fetching is disabled
Scenario: Create a resource with 1 levels of descendants then add a 2nd level of descendants when eager fetching is disabled
Given there is a max depth dummy with 1 level of descendants
When I add "Accept" header equal to "application/hal+json"
And I add "Content-Type" header equal to "application/json"
Expand All @@ -110,29 +64,6 @@ Feature: Max depth handling
Then the response status code should be 200
And the response should be in JSON
And the header "Content-Type" should be equal to "application/hal+json; charset=utf-8"
And the JSON should be equal to:
"""
{
"_links": {
"self": {
"href": "/max_depth_dummies/1"
},
"child": {
"href": "/max_depth_dummies/2"
}
},
"_embedded": {
"child": {
"_links": {
"self": {
"href": "/max_depth_dummies/2"
}
},
"id": 2,
"name": "level 2"
}
},
"id": 1,
"name": "level 1"
}
"""
Then the JSON node "_embedded" should exist
Then the JSON node "_embedded.child" should exist
Then the JSON node "_embedded.child._embedded" should not exist

0 comments on commit c8eb47c

Please sign in to comment.