Skip to content

Commit

Permalink
Fix JSON tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukel97 committed May 4, 2020
1 parent cd589d1 commit 2ff1129
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/JsonSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ responseMessageSpec = do
describe "invalid JSON" $ do
it "throws if neither result nor error is present" $ do
(J.eitherDecode "{\"jsonrpc\":\"2.0\",\"id\":1}" :: Either String (ResponseMessage ()))
`shouldBe` Left ("Error in $: both error and result cannot be Nothing")
`shouldBe` Left ("Error in $: Both error and result cannot be Nothing")
it "throws if both result and error are present" $ do
(J.eitherDecode
"{\"jsonrpc\":\"2.0\",\"id\": 1,\"result\":1,\"error\":{\"code\":-32700,\"message\":\"\",\"data\":null}}"
:: Either String (ResponseMessage Int))
`shouldSatisfy`
(either (\err -> isPrefixOf "Error in $: both error and result cannot be present" err) (\_ -> False))
(either (\err -> isPrefixOf "Error in $: Both error and result cannot be present" err) (\_ -> False))

-- ---------------------------------------------------------------------

Expand Down Expand Up @@ -148,4 +148,4 @@ instance Arbitrary FileSystemWatcher where
instance Arbitrary WatchKind where
arbitrary = WatchKind <$> arbitrary <*> arbitrary <*> arbitrary

-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------

0 comments on commit 2ff1129

Please sign in to comment.