Skip to content

Commit

Permalink
Disposing test observer after usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ivelten committed Feb 4, 2019
1 parent fd65327 commit 83cef85
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/FSharp.Data.GraphQL.Tests/MiddlewaresTests.fs
Expand Up @@ -198,7 +198,7 @@ let ``Deferred queries : Should pass when below threshold``() =
| Deferred(data, errors, deferred) ->
empty errors
data.["data"] |> equals (upcast expected)
let sub = Observer.create deferred
use sub = Observer.create deferred
sub.WaitCompleted()
sub.Received |> single |> equals (upcast expectedDeferred)
| _ -> fail "Expected Deferred GQLResponse"
Expand Down Expand Up @@ -251,7 +251,7 @@ let ``Streamed queries : Should pass when below threshold``() =
| Deferred(data, errors, deferred) ->
empty errors
data.["data"] |> equals (upcast expected)
let sub = Observer.create deferred
use sub = Observer.create deferred
sub.WaitCompleted(2)
sub.Received
|> Seq.cast<NameValueLookup>
Expand Down
2 changes: 1 addition & 1 deletion tests/FSharp.Data.GraphQL.Tests/Relay/NodeTests.fs
Expand Up @@ -63,7 +63,7 @@ let execAndValidateNode (query: string) expectedDirect expectedDeferred =
let expectedItemCount = Seq.length expectedDeferred
empty errors
data.["data"] |> equals (upcast NameValueLookup.ofList ["node", upcast expectedDirect])
let sub = Observer.create deferred
use sub = Observer.create deferred
sub.WaitCompleted(expectedItemCount)
sub.Received
|> Seq.cast<NameValueLookup>
Expand Down
12 changes: 6 additions & 6 deletions tests/FSharp.Data.GraphQL.Tests/SubscriptionTests.fs
Expand Up @@ -122,7 +122,7 @@ let ``Should be able to subscribe to sync field and get results``() =
let result = executor.AsyncExecute(query) |> sync
match result with
| Stream data ->
let sub = Observer.create data
use sub = Observer.create data
updateValue 1 "Updated value 1"
sub.WaitForItem()
sub.Received
Expand Down Expand Up @@ -150,7 +150,7 @@ let ``Should be able to subscribe to tagged sync field and get results with expe
let result = executor.AsyncExecute(query) |> sync
match result with
| Stream data ->
let sub = Observer.create data
use sub = Observer.create data
updateValue 1 "Updated value 1"
sub.WaitForItem()
sub.Received
Expand All @@ -170,7 +170,7 @@ let ``Should be able to subscribe to tagged sync field and do not get results wi
let result = executor.AsyncExecute(query) |> sync
match result with
| Stream data ->
let sub = Observer.create data
use sub = Observer.create data
updateValue 1 "Updated value 1"
ensureThat (fun () -> Seq.isEmpty sub.Received) 50 "Should not get results with given tag"
| _ -> failwith "Expected Stream GQLResponse"
Expand All @@ -194,7 +194,7 @@ let ``Should be able to subscribe to async field and get results``() =
let result = executor.AsyncExecute(query) |> sync
match result with
| Stream data ->
let sub = Observer.create data
use sub = Observer.create data
updateValue 1 "Updated value 1"
sub.WaitForItem()
sub.Received
Expand Down Expand Up @@ -222,7 +222,7 @@ let ``Should be able to subscribe to tagged async field and get results with exp
let result = executor.AsyncExecute(query) |> sync
match result with
| Stream data ->
let sub = Observer.create data
use sub = Observer.create data
updateValue 1 "Updated value 1"
sub.WaitForItem()
sub.Received
Expand All @@ -242,7 +242,7 @@ let ``Should be able to subscribe to tagged async field and do not get results w
let result = executor.AsyncExecute(query) |> sync
match result with
| Stream data ->
let sub = Observer.create data
use sub = Observer.create data
updateValue 1 "Updated value 1"
ensureThat (fun () -> Seq.isEmpty sub.Received) 50 "Should not get results with given tag"
| _ -> failwith "Expected Stream GQLResponse"

0 comments on commit 83cef85

Please sign in to comment.