Skip to content

Commit c3c3813

Browse files
Choc13gusty
authored andcommitted
Fix tests for Free.fold.
1 parent ede90ed commit c3c3813

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

tests/FSharpPlus.Tests/Free.fs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,17 +304,15 @@ module Fold =
304304
return foo |> Option.toResultWith NotFound
305305
}
306306

307-
// An example application layer that defines an interpreter for the GetFoo program which targets the async monad
308-
module App =
309-
let interpreter =
310-
Free.fold (function
311-
| GetFoo.Read (fooId, next) -> async { return Some({ Id = fooId; Name = "test" }) |> next })
312-
313307
[<Test>]
314-
let interpretProgramWithFold =
315-
async {
316-
let request: GetFoo.Request = { Id = FooId "1" }
317-
let! response = request |> GetFoo.handle |> App.interpreter
318-
319-
Assert.AreEqual(Some({ Id = FooId "1"; Name = "test" }), response)
320-
}
308+
let ``should interpret program with fold`` () =
309+
let request: GetFoo.Request = { Id = FooId "1" }
310+
let response =
311+
request
312+
|> GetFoo.handle
313+
|> Free.fold
314+
(function
315+
| GetFoo.Read (fooId, next) -> { Id = fooId; Name = "test" } |> Some |> next |> result)
316+
|> Identity.run
317+
318+
areStEqual (Ok { Id = FooId "1"; Name = "test" }) response

0 commit comments

Comments
 (0)