Skip to content

Commit

Permalink
add snapshot test for topic delete tx
Browse files Browse the repository at this point in the history
  • Loading branch information
QuestofIranon committed Feb 12, 2020
1 parent 16a5e12 commit 6bf783e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .snapshots/TestSerializeConsensusTopicDeleteTransaction
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
bodyBytes: "\n\014\n\006\010\316\247\212\345\005\022\002\030\002\022\002\030\003\030\300\204=\"\004\010\200\243\005\322\001\004\n\002\030c"
sigMap: <
sigPair: <
pubKeyPrefix: "\344\361\300\353L}\315\303\347\353\021p\263\010\212=\022\242\227\364\243\353\342\362\205\003\375g5F\355\216"
ed25519: "\340\240!e\360j(\230Y\352q\213\334,\335`\236v\247\326T\026c-\373&\024\004~\036P\304\024u\211\220\370\306R\267\024<\372\3220\272\205?\335J^:=\232\021NU2\207\315r\024\317\013"
>
>
transactionID: <
transactionValidStart: <
seconds: 1554158542
>
accountID: <
accountNum: 2
>
>
nodeAccountID: <
accountNum: 3
>
transactionFee: 1000000
transactionValidDuration: <
seconds: 86400
>
consensusDeleteTopic: <
topicID: <
topicNum: 99
>
>

35 changes: 35 additions & 0 deletions consensus_topic_delete_transaction_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package hedera

import (
"testing"
"time"

"github.com/bradleyjkemp/cupaloy"
"github.com/stretchr/testify/assert"
)

func TestSerializeConsensusTopicDeleteTransaction(t *testing.T) {
date := time.Unix(1554158542, 0)

testTopicID := ConsensusTopicID{Topic: 99}

key, err := Ed25519PrivateKeyFromString("302e020100300506032b6570042204203b054fade7a2b0869c6bd4a63b7017cbae7855d12acc357bea718e2c3e805962")
assert.NoError(t, err)

tx, err := NewConsensusTopicDeleteTransaction().
SetTopicID(testTopicID).
SetTransactionValidDuration(24 * time.Hour).
SetNodeAccountID(AccountID{Account: 3}).
SetTransactionID(TransactionID{
AccountID: AccountID{Account: 2},
ValidStart: date,
}).
SetMaxTransactionFee(HbarFromTinybar(1e6)).
Build(nil)

assert.NoError(t, err)

tx.Sign(key)

cupaloy.SnapshotT(t, tx.String())
}

0 comments on commit 6bf783e

Please sign in to comment.