packages feed

otel-effectful-1.0.0: test/Effectful/OpenTelemetry/Tracing/Trace/IDSpec.hs

module Effectful.OpenTelemetry.Tracing.Trace.IDSpec (spec) where

import Arbitrary ()
import Data.Aeson (Result (..), fromJSON, toJSON)
import Effectful
import Effectful.Hspec
import Effectful.OpenTelemetry.Tracing.Trace.ID (ID, fromBytes, toBytes)
import Effectful.QuickCheck ((===))
import Prelude

spec :: (Hspec :> es) => Eff es ()
spec = parallel do
    prop "toBytes/fromBytes round trip" \i -> fromBytes (toBytes i) === Right i
    prop "toJSON/fromJSON round trip" \i -> fromJSON @ID (toJSON i) === Success i