Add tests for memo parsing
This commit is contained in:
parent
11c5370962
commit
e6683a0450
2 changed files with 16 additions and 16 deletions
|
@ -325,7 +325,7 @@ zToZGoTx (ZcashTx t a aZ bh bt c conf m) = do
|
|||
".*ZGOp::([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}).*"
|
||||
let y =
|
||||
mkRegex
|
||||
".*MSG\\s(zs[a-z0-9]{76})\\sZGO::([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}).*"
|
||||
".*MSG\\s(zs[a-z0-9]{76})\\s+ZGO::([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}).*"
|
||||
let reg = matchAllText r (T.unpack m)
|
||||
let reg2 = matchAllText p (T.unpack m)
|
||||
let reg3 = matchAllText y (T.unpack m)
|
||||
|
@ -896,7 +896,7 @@ scanZcash config pipe = do
|
|||
".*ZGOp::([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}).*"
|
||||
let y =
|
||||
mkRegex
|
||||
".*MSG\\s(zs[a-z0-9]{76}).*ZGO::([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}).*"
|
||||
".*MSG\\s(zs[a-z0-9]{76})\\s+ZGO::([0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}).*"
|
||||
let k = map zToZGoTx (filter (isRelevant r) txs)
|
||||
mapM_ (access pipe master (c_dbName config) . upsertZGoTx "txs") k
|
||||
let j = map zToZGoTx (filter (isRelevant p) txs)
|
||||
|
|
28
test/Spec.hs
28
test/Spec.hs
|
@ -61,14 +61,14 @@ main = do
|
|||
1602000
|
||||
18732456
|
||||
False
|
||||
20
|
||||
5
|
||||
"ZGO::5d3d4494-51c0-432d-8495-050419957aea\nReply-To:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||
zToZGoTx t `shouldBe`
|
||||
ZGoTx
|
||||
Nothing
|
||||
"zs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||
"5d3d4494-51c0-432d-8495-050419957aea"
|
||||
20
|
||||
5
|
||||
18732456
|
||||
0.5
|
||||
"someId"
|
||||
|
@ -82,18 +82,18 @@ main = do
|
|||
1602000
|
||||
18732456
|
||||
False
|
||||
20
|
||||
"fjbMSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\nZGO::5d3d4494-51c0-432d-8495-050419957aea"
|
||||
5
|
||||
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGO::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||
zToZGoTx t `shouldBe`
|
||||
ZGoTx
|
||||
Nothing
|
||||
"zs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||
"5d3d4494-51c0-432d-8495-050419957aea"
|
||||
20
|
||||
"ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||
5
|
||||
18732456
|
||||
0.5
|
||||
"someId"
|
||||
"fjbMSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\nZGO::5d3d4494-51c0-432d-8495-050419957aea"
|
||||
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGO::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||
it "converts ZecWallet payment tx to ZGo tx" $ do
|
||||
let t =
|
||||
ZcashTx
|
||||
|
@ -103,14 +103,14 @@ main = do
|
|||
1602000
|
||||
18732456
|
||||
False
|
||||
20
|
||||
5
|
||||
"ZGOp::5d3d4494-51c0-432d-8495-050419957aea\nReply-To:\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e"
|
||||
zToZGoTx t `shouldBe`
|
||||
ZGoTx
|
||||
Nothing
|
||||
""
|
||||
"5d3d4494-51c0-432d-8495-050419957aea"
|
||||
20
|
||||
5
|
||||
18732456
|
||||
0.5
|
||||
"someId"
|
||||
|
@ -124,18 +124,18 @@ main = do
|
|||
1602000
|
||||
18732456
|
||||
False
|
||||
20
|
||||
"fjbMSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\nZGOp::5d3d4494-51c0-432d-8495-050419957aea"
|
||||
5
|
||||
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGOp::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||
zToZGoTx t `shouldBe`
|
||||
ZGoTx
|
||||
Nothing
|
||||
""
|
||||
"5d3d4494-51c0-432d-8495-050419957aea"
|
||||
20
|
||||
"ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||
5
|
||||
18732456
|
||||
0.5
|
||||
"someId"
|
||||
"fjbMSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\nZGOp::5d3d4494-51c0-432d-8495-050419957aea"
|
||||
"\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGOp::ad8477d3-4fdd-4c97-90b2-76630b5f77e1"
|
||||
describe "PIN generator" $ do
|
||||
it "should give a 7 digit" $ do
|
||||
length (T.unpack (unsafePerformIO (generatePin 1010))) `shouldBe` 7
|
||||
|
|
Loading…
Reference in a new issue