Skip to content
Snippets Groups Projects
Unverified Commit 63f91803 authored by Benjamin Bollen's avatar Benjamin Bollen
Browse files

client: add construction test for NameTx

parent 69612370
No related branches found
No related tags found
No related merge requests found
......@@ -28,8 +28,8 @@ func TestTransactionFactory(t *testing.T) {
mockKeyClient := mockkeys.NewMockKeyClient()
mockNodeClient := mockclient.NewMockNodeClient()
testTransactionFactorySend(t, mockNodeClient, mockKeyClient)
// t.Run("NameTransaction", )
testTransactionFactoryCall(t, mockNodeClient, mockKeyClient)
testTransactionFactoryName(t, mockNodeClient, mockKeyClient)
// t.Run("PermissionTransaction", )
// t.Run("BondTransaction", )
// t.Run("UnbondTransaction", )
......@@ -80,7 +80,7 @@ func testTransactionFactoryCall(t *testing.T,
amountString := "1000"
// unset nonce so that we retrieve nonce from account
nonceString := ""
// set gas
// set gas
gasString := "1000"
// set fee
feeString := "100"
......@@ -94,4 +94,35 @@ func testTransactionFactoryCall(t *testing.T,
t.Fail()
}
// TODO: test content of Transaction
}
\ No newline at end of file
}
func testTransactionFactoryName(t *testing.T,
nodeClient *mockclient.MockNodeClient, keyClient *mockkeys.MockKeyClient) {
// generate an ED25519 key and ripemd160 address
addressString := fmt.Sprintf("%X", keyClient.NewKey())
// Public key can be queried from mockKeyClient.PublicKey(address)
// but here we let the transaction factory retrieve the public key
// which will then also overwrite the address we provide the function.
// As a result we will assert whether address generated above, is identical
// to address in generated transation.
publicKeyString := ""
// set an amount to transfer
amountString := "1000"
// unset nonce so that we retrieve nonce from account
nonceString := ""
// set fee
feeString := "100"
// set data
dataString := fmt.Sprintf("%X", "We are DOUG.")
// set name
nameString := fmt.Sprintf("%s", "DOUG")
_, err := Name(nodeClient, keyClient, publicKeyString, addressString,
amountString, nonceString, feeString, nameString, dataString)
if err != nil {
t.Logf("Error in NameTx: %s", err)
t.Fail()
}
// TODO: test content of Transaction
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment