@@ -7,25 +7,28 @@ import Prelude
77import Cardano.AsCbor (decodeCbor )
88import Ctl.Internal.QueryM.Ogmios (parseIpv6String )
99import Data.ByteArray (hexToByteArrayUnsafe )
10+ import Data.Maybe (Maybe (Nothing))
1011import Data.Newtype (wrap )
1112import Effect.Aff (Aff )
1213import Mote (group , test )
1314import Mote.TestPlanM (TestPlanM )
14- import Test.Spec.Assertions (shouldEqual )
15+ import Test.Spec.Assertions (shouldEqual , shouldNotEqual )
1516
1617suite :: TestPlanM (Aff Unit ) Unit
1718suite = do
1819 group " Ipv6 type (parsing)" do
1920 testIpv6 " 2345:425:2CA1:0000:0000:567:5673:23b5"
20- " 234504252CA1000000000567567323b5 "
21+ " 50234504252CA1000000000567567323b5 "
2122 testIpv6 " 2345:0425:2CA1:0:0:0567:5673:23b5"
22- " 234504252CA1000000000567567323b5"
23- testIpv6 " 2345:0425:2CA1::0567:5673:23b5" " 234504252CA1000000000567567323b5"
24- testIpv6 " 2345:0425:2CA1::5673:23b5" " 234504252CA1000000000000567323b5"
25- testIpv6 " 2345:0425:2CA1::23b5" " 234504252CA1000000000000000023b5"
23+ " 50234504252CA1000000000567567323b5"
24+ testIpv6 " 2345:0425:2CA1::0567:5673:23b5"
25+ " 50234504252CA1000000000567567323b5"
26+ testIpv6 " 2345:0425:2CA1::5673:23b5" " 50234504252CA1000000000000567323b5"
27+ testIpv6 " 2345:0425:2CA1::23b5" " 50234504252CA1000000000000000023b5"
2628
2729testIpv6 :: String -> String -> TestPlanM (Aff Unit ) Unit
2830testIpv6 str expected =
2931 test str do
30- parseIpv6String str `shouldEqual`
31- (decodeCbor (wrap $ hexToByteArrayUnsafe expected))
32+ let ipv6 = parseIpv6String str
33+ ipv6 `shouldNotEqual` Nothing
34+ ipv6 `shouldEqual` (decodeCbor (wrap $ hexToByteArrayUnsafe expected))
0 commit comments