rvv001 - Issue 085 - [Zenith GUI] Read a payment URI
Additional cases added to Test Suite
This commit is contained in:
parent
d476183a1d
commit
02ec4716e9
2 changed files with 18 additions and 2 deletions
|
@ -285,7 +285,7 @@ getZcashPrice currency = do
|
|||
-- Parse memo result to convert it to a ByteString
|
||||
processEither :: Either String BC.ByteString -> BC.ByteString
|
||||
processEither (Right bs) = bs
|
||||
processEither (Left e) = BC.pack e -- Returns the error
|
||||
processEither (Left e) = BC.pack e -- Returns the error message
|
||||
|
||||
-- Parse the query string into key-value pairs
|
||||
parseQuery :: String -> [(String, String)]
|
||||
|
|
18
test/Spec.hs
18
test/Spec.hs
|
@ -1111,7 +1111,7 @@ main = do
|
|||
case price of
|
||||
Just p -> p `shouldNotBe` 0.0
|
||||
Nothing -> assertFailure "Failed to get ZEC price"
|
||||
describe "Parse an URI payment string" $ do
|
||||
describe "Parse an URI payment string (all fields filled) " $ do
|
||||
it ("Parsing URI -> " ++ "zcash:ztestsapling10yy2ex5....") $ do
|
||||
let zcashURI2 = "zcash:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=100&memo=SGVsbG8sIFdvcmxkIQ==&message=Test"
|
||||
case parseZcashPayment zcashURI2 of
|
||||
|
@ -1119,3 +1119,19 @@ main = do
|
|||
print p
|
||||
(uriAmount p) `shouldBe` Just 100.0
|
||||
Left e -> assertFailure $ "Error: " ++ e
|
||||
describe "Parse an URI payment string (just address and amount fields provided) " $ do
|
||||
it ("Parsing URI -> " ++ "zcash:ztestsapling10yy2ex5....") $ do
|
||||
let zcashURI3 = "zcash:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=100"
|
||||
case parseZcashPayment zcashURI3 of
|
||||
Right p -> do
|
||||
print p
|
||||
(uriAmount p) `shouldBe` Just 100.0
|
||||
Left e -> assertFailure $ "Error: " ++ e
|
||||
describe "Parse an URI payment string (invalid URI provided) " $ do
|
||||
it ("Parsing URI -> " ++ "zcash:ztestsapling10yy2ex5....") $ do
|
||||
let zcashURI3 = "z:ztestsapling10yy2ex5dcqkclhc7z7yrnjq2z6feyjad56ptwlfgmy77dmaqqrl9gyhprdx59qgmsnyfska2kez?amount=100"
|
||||
case parseZcashPayment zcashURI3 of
|
||||
Right p -> do
|
||||
print p
|
||||
(uriAmount p) `shouldBe` Just 100.0
|
||||
Left e -> assertFailure $ "Error: " ++ e
|
||||
|
|
Loading…
Reference in a new issue