forked from hiero-ledger/hiero-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpending_airdrop_record_unit_test.go
More file actions
49 lines (36 loc) · 1.33 KB
/
Copy pathpending_airdrop_record_unit_test.go
File metadata and controls
49 lines (36 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//go:build all || unit
package hiero
// SPDX-License-Identifier: Apache-2.0
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestUnitPendingAirdropRecordProtoRoundTrip(t *testing.T) {
t.Parallel()
accID, err := AccountIDFromString("0.0.123")
require.NoError(t, err)
tokenID, err := TokenIDFromString("0.0.456")
require.NoError(t, err)
original := PendingAirdropRecord{
pendingAirdropId: PendingAirdropId{&accID, &accID, &tokenID, nil},
pendingAirdropAmount: 789,
}
roundTripped := _PendingAirdropRecordFromProtobuf(original._ToProtobuf())
assert.Equal(t, original, roundTripped)
assert.Equal(t, uint64(789), roundTripped.GetPendingAirdropAmount())
assert.Equal(t, original.GetPendingAirdropId(), roundTripped.GetPendingAirdropId())
}
func TestUnitPendingAirdropRecordString(t *testing.T) {
t.Parallel()
accID, err := AccountIDFromString("0.0.123")
require.NoError(t, err)
tokenID, err := TokenIDFromString("0.0.456")
require.NoError(t, err)
record := PendingAirdropRecord{
pendingAirdropId: PendingAirdropId{&accID, &accID, &tokenID, nil},
pendingAirdropAmount: 789,
}
expected := "PendingAirdropRecord{PendingAirdropId: Sender: 0.0.123, Receiver: 0.0.123, TokenID: 0.0.456, NftID: nil, PendingAirdropAmount: 789}"
assert.Equal(t, expected, record.String())
}