packages feed

fluent-effectful-1.0.0: test/Effectful/Fluent/SingleSpec.hs

module Effectful.Fluent.SingleSpec (spec) where

import Data.Text (Text)
import Effectful
import Effectful.Fluent.Single
import Effectful.Hspec
import Util
import Prelude

spec :: (Hspec :> es) => Eff es ()
spec = runFluent english do
    it "reads from its one bundle without being told a locale" do
        translate "greeting" `shouldReturn` Right "Hello!"
        translate "welcome" ("name", "Ann" :: Text) `shouldReturn` Right "Welcome, \8296Ann\8297"

    it "says why a message is missing" do
        translate "missing" `shouldReturn` Left "Message not found: \"missing\""