diff --git a/test/Feature/QuerySpec.hs b/test/Feature/QuerySpec.hs index e3f83c6e3..6256e195a 100644 --- a/test/Feature/QuerySpec.hs +++ b/test/Feature/QuerySpec.hs @@ -172,3 +172,15 @@ spec = [json| [{"data": {"foo": {"bar": "baz"}}}] |] get "/json?data->foo->>bar=eq.fake" `shouldRespondWith` [json| [] |] + + describe "remote procedure call" $ do + context "a proc that returns a set" . before_ (clearTable "items" >> createItems 10) . + after_ (clearTable "items") $ + it "returns proper json" $ + post "/rpc/getitemrange" [json| { "min": 2, "max": 4 } |] `shouldRespondWith` + [json| [ {"id": 3}, {"id":4} ] |] + + context "a proc that returns plain text" $ + it "returns proper json" $ + post "/rpc/sayhello" [json| { "name": "world" } |] `shouldRespondWith` + [json| [{"sayhello":"Hello, world"}] |]