Test updates
This commit is contained in:
parent
ea731df20d
commit
e0f263f7f0
3 changed files with 58 additions and 4 deletions
|
@ -364,10 +364,11 @@ zToZGoTx (ZcashTx t a aZ bh bt c conf m) = do
|
||||||
|
|
||||||
zToZGoTx' :: Config -> Pipe -> ZcashTx -> IO ()
|
zToZGoTx' :: Config -> Pipe -> ZcashTx -> IO ()
|
||||||
zToZGoTx' config pipe (ZcashTx t a aZ bh bt c conf m) = do
|
zToZGoTx' config pipe (ZcashTx t a aZ bh bt c conf m) = do
|
||||||
when (conf < 100) $ do
|
when (conf < c_confirmations config) $ do
|
||||||
let zM = runParser pZGoMemo (T.unpack t) m
|
let zM = runParser pZGoMemo (T.unpack t) m
|
||||||
case zM of
|
case zM of
|
||||||
Right zM' -> do
|
Right zM' -> do
|
||||||
|
print zM'
|
||||||
let tx =
|
let tx =
|
||||||
ZGoTx
|
ZGoTx
|
||||||
Nothing
|
Nothing
|
||||||
|
|
57
test/Spec.hs
57
test/Spec.hs
|
@ -81,6 +81,17 @@ 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
|
||||||
|
let m =
|
||||||
|
runParser
|
||||||
|
pZGoMemo
|
||||||
|
"Zingo memo"
|
||||||
|
"ZGO::5d3d4494-51c0-432d-8495-050419957aea\nReply to:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||||
|
case m of
|
||||||
|
Left e -> putStrLn $ errorBundlePretty e
|
||||||
|
Right m' ->
|
||||||
|
m_session m' `shouldBe`
|
||||||
|
U.fromString "5d3d4494-51c0-432d-8495-050419957aea"
|
||||||
it "converts ZecWallet tx to ZGo tx" $ do
|
it "converts ZecWallet tx to ZGo tx" $ do
|
||||||
let t =
|
let t =
|
||||||
ZcashTx
|
ZcashTx
|
||||||
|
@ -123,6 +134,27 @@ main = do
|
||||||
0.5
|
0.5
|
||||||
"someId"
|
"someId"
|
||||||
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGO::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGO::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||||
|
it "converts Zingo tx to ZGo tx" $ do
|
||||||
|
let t =
|
||||||
|
ZcashTx
|
||||||
|
"someId"
|
||||||
|
0.5
|
||||||
|
50000000
|
||||||
|
1602000
|
||||||
|
18732456
|
||||||
|
False
|
||||||
|
5
|
||||||
|
"ZGO::5d3d4494-51c0-432d-8495-050419957aea\nReply to:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||||
|
zToZGoTx t `shouldBe`
|
||||||
|
ZGoTx
|
||||||
|
Nothing
|
||||||
|
"zs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||||
|
"5d3d4494-51c0-432d-8495-050419957aea"
|
||||||
|
5
|
||||||
|
18732456
|
||||||
|
0.5
|
||||||
|
"someId"
|
||||||
|
"ZGO::5d3d4494-51c0-432d-8495-050419957aea\nReply to:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||||
it "converts ZecWallet payment tx to ZGo tx" $ do
|
it "converts ZecWallet payment tx to ZGo tx" $ do
|
||||||
let t =
|
let t =
|
||||||
ZcashTx
|
ZcashTx
|
||||||
|
@ -165,6 +197,27 @@ main = do
|
||||||
0.5
|
0.5
|
||||||
"someId"
|
"someId"
|
||||||
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGOp::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGOp::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||||
|
it "converts Zingo payment tx to ZGo tx" $ do
|
||||||
|
let t =
|
||||||
|
ZcashTx
|
||||||
|
"someId"
|
||||||
|
0.5
|
||||||
|
50000000
|
||||||
|
1602000
|
||||||
|
18732456
|
||||||
|
False
|
||||||
|
5
|
||||||
|
"ZGOp::5d3d4494-51c0-432d-8495-050419957aea\nReply to:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||||
|
zToZGoTx t `shouldBe`
|
||||||
|
ZGoTx
|
||||||
|
Nothing
|
||||||
|
""
|
||||||
|
"5d3d4494-51c0-432d-8495-050419957aea"
|
||||||
|
5
|
||||||
|
18732456
|
||||||
|
0.5
|
||||||
|
"someId"
|
||||||
|
"ZGOp::5d3d4494-51c0-432d-8495-050419957aea\nReply to:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||||
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
|
||||||
|
@ -909,7 +962,7 @@ main = do
|
||||||
xit "logins are added to db" $ \p -> do
|
xit "logins are added to db" $ \p -> do
|
||||||
_ <-
|
_ <-
|
||||||
access p master "test" (Database.MongoDB.delete (select [] "txs"))
|
access p master "test" (Database.MongoDB.delete (select [] "txs"))
|
||||||
_ <- scanZcash loadedConfig p
|
_ <- scanZcash' loadedConfig p
|
||||||
threadDelay 1000000
|
threadDelay 1000000
|
||||||
t <- access p master "test" $ findOne (select [] "txs")
|
t <- access p master "test" $ findOne (select [] "txs")
|
||||||
let s = parseZGoTxBson =<< t
|
let s = parseZGoTxBson =<< t
|
||||||
|
@ -922,7 +975,7 @@ main = do
|
||||||
master
|
master
|
||||||
"test"
|
"test"
|
||||||
(Database.MongoDB.delete (select [] "payments"))
|
(Database.MongoDB.delete (select [] "payments"))
|
||||||
_ <- scanZcash loadedConfig p
|
_ <- scanZcash' loadedConfig p
|
||||||
threadDelay 1000000
|
threadDelay 1000000
|
||||||
t <- access p master "test" $ findOne (select [] "payments")
|
t <- access p master "test" $ findOne (select [] "payments")
|
||||||
let s = (cast' . Doc) =<< t
|
let s = (cast' . Doc) =<< t
|
||||||
|
|
|
@ -5,7 +5,7 @@ cabal-version: 1.12
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
|
|
||||||
name: zgo-backend
|
name: zgo-backend
|
||||||
version: 1.6.0
|
version: 1.7.0
|
||||||
synopsis: Haskell Back-end for the ZGo point-of-sale application
|
synopsis: Haskell Back-end for the ZGo point-of-sale application
|
||||||
description: Please see the README at <https://git.vergara.tech/Vergara_Tech//zgo-backend#readme>
|
description: Please see the README at <https://git.vergara.tech/Vergara_Tech//zgo-backend#readme>
|
||||||
category: Web
|
category: Web
|
||||||
|
|
Loading…
Reference in a new issue