Hi everybody! For my unit tests I wanted to read a json file with all test cases and run them with something like
runTestCase tc =
test "a check" do
Assert.equal tc.request.body tc.response.body
main :: Effect Unit
main =
launchAff_ do
rs <- readOrThrow "./test/Server/testCases.json"
ts <- mkTestCase "./test/Server" `traverse` rs
runTestWith runTest do
suite "Tests" do
runTestCase `traverse` ts
The error is Could not match type Array Unit with type Unit.
Does somebody know how to resolve this?
I’m pretty sure the issue is with your last line. runTestCase looks like TestCase -> Effect Unit, and ts looks like an Array TestCase, so when you call traverse, you end up with an Effect (Array Unit). You can only put an effect on a line by itself without binding it to a name if it’s type is Effect Unit. So to resolve it, you could either do