Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Christer van der Meeren committed Dec 18, 2023
1 parent 668c154 commit e0ffb40
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Felicity.IntegrationTests/SkipLinks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module A =

let toMany = define.Relationship.ToMany(resDef).Get(fun _ -> [])

let post = define.Operation.Post(fun () -> A)

let get = define.Operation.GetResource()

let customOp =
Expand Down Expand Up @@ -208,4 +210,19 @@ let tests =
Expect.isTrue (json |> hasNoPath "errors[2]") ""
}

testJob "Has Location header in POST response even if resource link is skipped" {
let client = getClient ()

let! response =
Request.createWithClient client Post (Uri("http://example.com/as?skipAllLinks"))
|> Request.jsonApiHeaders
|> Request.bodySerialized {| data = {| ``type`` = "a" |} |}
|> getResponse

response |> testSuccessStatusCode
let! json = response |> Response.readBodyAsString
Expect.isFalse (json |> hasPath "data.links") ""
Expect.isTrue (response.headers.TryFind Location = Some "http://example.com/as/1") ""
}

]

0 comments on commit e0ffb40

Please sign in to comment.