otel-effectful-1.0.0: test/Effectful/OpenTelemetry/Protocol/AttributesSpec.hs
{- HLINT ignore "Monoid law, left identity" -}
{- HLINT ignore "Monoid law, right identity" -}
module Effectful.OpenTelemetry.Protocol.AttributesSpec (spec) where
import Arbitrary ()
import Data.Aeson qualified as Aeson
import Effectful
import Effectful.Hspec
import Effectful.OpenTelemetry.Protocol.Attributes (Attributes)
import Prelude
spec :: (Hspec :> es) => Eff es ()
spec = parallel do
prop "associativity" \(a :: Attributes) b c ->
(a <> b) <> c `shouldBe` a <> (b <> c)
prop "identity" \(a :: Attributes) -> do
mempty <> a `shouldBe` a
a <> mempty `shouldBe` a
prop "toJSON/fromJSON round-trip" \(attrs :: Attributes) ->
(Aeson.fromJSON . Aeson.toJSON) attrs `shouldBe` Aeson.Success attrs