test: spread embed disambiguates recursive m2m
This commit is contained in:
committed by
Steve Chavez
parent
60c0c11c1d
commit
25f65065f4
@@ -109,6 +109,18 @@ spec =
|
||||
get "/whatev_sites?select=*,whatev_jobs!site_id_2(..whatev_projects!project_id_1(*))" `shouldRespondWith` [json|[]|]
|
||||
get "/whatev_sites?select=*,whatev_jobs!site_id_2(..whatev_projects!project_id_2(*))" `shouldRespondWith` [json|[]|]
|
||||
|
||||
it "can disambiguate a recursive m2m with spread embeds" $ do
|
||||
get "/posters?select=*,subscribers:subscriptions!subscribed(..posters!subscriber(*))&limit=1" `shouldRespondWith`
|
||||
[json| [ {"id":1,"name":"Mark","subscribers":[{"id":3,"name":"Bill"}, {"id":4,"name":"Jeff"}]}]|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
get "/posters?select=*,subscriptions!subscriber(..posters!subscribed(*))&limit=1" `shouldRespondWith`
|
||||
[json| [{"id":1,"name":"Mark","subscriptions":[{"id":2,"name":"Elon"}]}]|]
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = [matchContentTypeJson]
|
||||
}
|
||||
|
||||
it "errs on an ambiguous embed that has two one-to-one relationships" $
|
||||
get "/first?select=second(*)" `shouldRespondWith`
|
||||
[json| {
|
||||
|
||||
Reference in New Issue
Block a user