diff --git a/test/Spec.hs b/test/Spec.hs index 264d458..5cd7576 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -56,7 +56,7 @@ main = do describe "hex strings" $ do prop "encoding and decoding are inverse" $ \x -> (decodeHexText . encodeHexText) x == x - describe "zToZGoTx" $ + describe "Memo parsers" $ --prop "memo parsing" testMemoParser do it "parse ZecWallet memo" $ do @@ -92,132 +92,6 @@ main = do Right m' -> m_session m' `shouldBe` U.fromString "5d3d4494-51c0-432d-8495-050419957aea" - it "converts ZecWallet 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 YWallet tx to ZGo tx" $ do - let t = - ZcashTx - "someId" - 0.5 - 50000000 - 1602000 - 18732456 - False - 5 - "\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGO::ad8477d3-4fdd-4c97-90b2-76630b5f77e1" - zToZGoTx t `shouldBe` - ZGoTx - Nothing - "zs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e" - "ad8477d3-4fdd-4c97-90b2-76630b5f77e1" - 5 - 18732456 - 0.5 - "someId" - "\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 - 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" - it "converts YWallet payment tx to ZGo tx" $ do - let t = - ZcashTx - "someId" - 0.5 - 50000000 - 1602000 - 18732456 - False - 5 - "\128737MSG\nzs1w6nkameazc5gujm69350syl5w8tgvyaphums3pw8eytzy5ym08x7dvskmykkatmwrucmgv3er8e\n\nZGOp::ad8477d3-4fdd-4c97-90b2-76630b5f77e1" - zToZGoTx t `shouldBe` - ZGoTx - Nothing - "" - "ad8477d3-4fdd-4c97-90b2-76630b5f77e1" - 5 - 18732456 - 0.5 - "someId" - "\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 it "should give a 7 digit" $ do pin <- generatePin @@ -1211,17 +1085,40 @@ unwrapDoc _ = [] startAPI :: Config -> IO () startAPI config = do putStrLn "Starting test server ..." - pipe <- connect $ host "127.0.0.1" - c <- access pipe master "zgo" (auth "zgo" "zcashrules") + pipe <- connect $ host $ c_dbHost config + c <- access pipe master "zgo" (auth (c_dbUser config) (c_dbPassword config)) let appRoutes = routes pipe config _ <- forkIO (scotty 3000 appRoutes) _ <- - access pipe master "test" (Database.MongoDB.delete (select [] "wootokens")) - _ <- access pipe master "test" (Database.MongoDB.delete (select [] "users")) - _ <- access pipe master "test" (Database.MongoDB.delete (select [] "items")) - _ <- access pipe master "test" (Database.MongoDB.delete (select [] "orders")) + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "wootokens")) _ <- - access pipe master "test" (Database.MongoDB.delete (select [] "xerotokens")) + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "users")) + _ <- + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "items")) + _ <- + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "orders")) + _ <- + access + pipe + master + (c_dbName config) + (Database.MongoDB.delete (select [] "xerotokens")) let myUser = User (Just (read "6272a90f2b05a74cf1000001" :: ObjectId))