Add tests for parsing UAs

This commit is contained in:
Rene Vergara 2023-09-28 10:46:41 -05:00
parent 51ae13e53b
commit c5724d6d4a
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -59,7 +59,7 @@ main = do
describe "Memo parsers" $ describe "Memo parsers" $
--prop "memo parsing" testMemoParser --prop "memo parsing" testMemoParser
do do
it "parse ZecWallet memo" $ do it "parse ZecWallet memo - Sapling" $ do
let m = let m =
runParser runParser
pZGoMemo pZGoMemo
@ -70,7 +70,7 @@ main = do
Right m' -> Right m' ->
m_session m' `shouldBe` m_session m' `shouldBe`
U.fromString "5d3d4494-51c0-432d-8495-050419957aea" U.fromString "5d3d4494-51c0-432d-8495-050419957aea"
it "parse YWallet memo" $ do it "parse YWallet memo - Sapling" $ do
let m = let m =
runParser runParser
pZGoMemo pZGoMemo
@ -81,7 +81,7 @@ main = do
Right m' -> Right m' ->
m_session m' `shouldBe` m_session m' `shouldBe`
U.fromString "ad8477d3-4fdd-4c97-90b2-76630b5f77e1" U.fromString "ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
it "parse Zingo memo" $ do it "parse Zingo memo - Sapling" $ do
let m = let m =
runParser runParser
pZGoMemo pZGoMemo
@ -92,6 +92,39 @@ main = do
Right m' -> Right m' ->
m_session m' `shouldBe` m_session m' `shouldBe`
U.fromString "5d3d4494-51c0-432d-8495-050419957aea" U.fromString "5d3d4494-51c0-432d-8495-050419957aea"
it "parse ZecWallet memo - Orchard" $ do
let m =
runParser
pZGoMemo
"Zecwalllet memo"
"ZGO::5d3d4494-51c0-432d-8495-050419957aea\nReply-To:\nu17n7hpwaujyq7ux8f9jpyymtnk5urw7pyrf60smp5mawy7jgz325hfvz3jn3zsfya8yxryf9q7ldk8nu8df0emra5wne28zq9d9nm2pu4x6qwjha565av9aze0xgujgslz74ufkj0c0cylqwjyrh9msjfh7jzal6d3qzrnhkkqy3pqm8j63y07jxj7txqeac982778rmt64f32aum94x"
case m of
Left e -> putStrLn $ errorBundlePretty e
Right m' ->
m_session m' `shouldBe`
U.fromString "5d3d4494-51c0-432d-8495-050419957aea"
it "parse YWallet memo - Orchard" $ do
let m =
runParser
pZGoMemo
"Ywallet memo"
"\128737MSG\nu17n7hpwaujyq7ux8f9jpyymtnk5urw7pyrf60smp5mawy7jgz325hfvz3jn3zsfya8yxryf9q7ldk8nu8df0emra5wne28zq9d9nm2pu4x6qwjha565av9aze0xgujgslz74ufkj0c0cylqwjyrh9msjfh7jzal6d3qzrnhkkqy3pqm8j63y07jxj7txqeac982778rmt64f32aum94x\n\nZGO::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
case m of
Left e -> putStrLn $ errorBundlePretty e
Right m' ->
m_session m' `shouldBe`
U.fromString "ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
it "parse Zingo memo - Orchard" $ do
let m =
runParser
pZGoMemo
"Zingo memo"
"ZGO::5d3d4494-51c0-432d-8495-050419957aea\nReply to:\nu17n7hpwaujyq7ux8f9jpyymtnk5urw7pyrf60smp5mawy7jgz325hfvz3jn3zsfya8yxryf9q7ldk8nu8df0emra5wne28zq9d9nm2pu4x6qwjha565av9aze0xgujgslz74ufkj0c0cylqwjyrh9msjfh7jzal6d3qzrnhkkqy3pqm8j63y07jxj7txqeac982778rmt64f32aum94x"
case m of
Left e -> putStrLn $ errorBundlePretty e
Right m' ->
m_session m' `shouldBe`
U.fromString "5d3d4494-51c0-432d-8495-050419957aea"
describe "PIN generator" $ do describe "PIN generator" $ do
it "should give a 7 digit" $ do it "should give a 7 digit" $ do
pin <- generatePin pin <- generatePin
@ -262,7 +295,7 @@ main = do
it "return owner by id" $ do it "return owner by id" $ do
req <- req <-
testGet testGet
"/api/ownerid" "/ownerid"
[ ("id", Just "627ad3492b05a76be3000001") [ ("id", Just "627ad3492b05a76be3000001")
, ("session", Just "35bfb9c2-9ad2-4fe5-adda-99d63b8dcdcd") , ("session", Just "35bfb9c2-9ad2-4fe5-adda-99d63b8dcdcd")
] ]