Skip to content

Commit

Permalink
[test] refs #279 - Integrate SkycoinCreatedTransaction into tests
Browse files Browse the repository at this point in the history
  • Loading branch information
e1Ru1o committed Jan 26, 2020
1 parent 7982622 commit f6a1552
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions src/coin/skycoin/models/coin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ func TestTransactionGetStatus(t *testing.T) {
txn core.Transaction
want core.TransactionStatus
}{
{
name: "SkycoinCreatedTransaction-Created",
txn: new(SkycoinCreatedTransaction),
want: core.TXN_STATUS_CREATED,
},
{
name: "SkycoinCreatedTransaction-Created",
txn: &SkycoinCreatedTransaction{
skyTxn: api.CreatedTransaction{Length: 10},
},
want: core.TXN_STATUS_CREATED,
},
{
name: "SkycoinTransaction-Confirmed",
txn: &SkycoinTransaction{
Expand Down Expand Up @@ -131,6 +143,25 @@ func TestSkycoinTransactionGetInputs(t *testing.T) {
ids []string
wantNil bool
}{
{
name: "SkycoinCreatedTransaction",
txn: &SkycoinCreatedTransaction{
skyTxn: api.CreatedTransaction{
In: []api.CreatedTransactionInput{
api.CreatedTransactionInput{
UxID: "out1", Coins: "20", Hours: "20",
},
api.CreatedTransactionInput{
UxID: "out2", Coins: "20", Hours: "20",
},
api.CreatedTransactionInput{
UxID: "out3", Coins: "20", Hours: "20",
},
},
},
},
ids: []string{"out1", "out2", "out3"},
},
{
name: "SkycoinTransaction-ApiError",
txn: st,
Expand Down Expand Up @@ -350,6 +381,13 @@ func TestTransactionsGetTimestamp(t *testing.T) {
txn: new(SkycoinUninjectedTransaction),
want: 0,
},
{
name: "SkycoinCreatedTransaction-Created",
txn: &SkycoinCreatedTransaction{
skyTxn: api.CreatedTransaction{Length: 10},
},
want: 0,
},
{
name: "SkycoinTransaction",
txn: &SkycoinTransaction{
Expand All @@ -368,6 +406,11 @@ func TestTransactionsGetTimestamp(t *testing.T) {
},
want: uint64(cur.Unix()),
},
{
name: "SkycoinCreatedTransaction",
txn: new(SkycoinCreatedTransaction),
want: 0,
},
}

for _, tt := range tests {
Expand Down Expand Up @@ -1126,6 +1169,25 @@ func TestSkycoinTransactionGetOutputs(t *testing.T) {
ids []string
wantNil bool
}{
{
name: "SkycoinCreatedTransaction",
txn: &SkycoinCreatedTransaction{
skyTxn: api.CreatedTransaction{
Out: []api.CreatedTransactionOutput{
api.CreatedTransactionOutput{
UxID: "out1", Coins: "20", Hours: "20",
},
api.CreatedTransactionOutput{
UxID: "out2", Coins: "20", Hours: "20",
},
api.CreatedTransactionOutput{
UxID: "out3", Coins: "20", Hours: "20",
},
},
},
},
ids: []string{"out1", "out2", "out3"},
},
{
name: "SkycoinTransaction1",
txn: st,
Expand Down Expand Up @@ -1299,6 +1361,10 @@ func TestTransactionVerifyUnsigned(t *testing.T) {
name: "empty Txn",
txn: new(SkycoinTransaction),
},
{
name: "empty Txn",
txn: new(SkycoinCreatedTransaction),
},
//TODO: add better tests
}

Expand All @@ -1324,6 +1390,10 @@ func TestTransactionVerifySigned(t *testing.T) {
name: "empty Txn",
txn: new(SkycoinTransaction),
},
{
name: "empty Txn",
txn: new(SkycoinCreatedTransaction),
},
//TODO: add better tests
}

Expand Down

0 comments on commit f6a1552

Please sign in to comment.