Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/token_supply_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ func (tokenSupplyType TokenSupplyType) String() string {
return "TOKEN_SUPPLY_TYPE_FINITE"
}

panic(fmt.Sprintf("unreachable: TokenType.String() switch statement is non-exhaustive. Status: %v", uint32(tokenSupplyType)))
panic(fmt.Sprintf("unreachable: TokenSupplyType.String() switch statement is non-exhaustive. Status: %v", uint32(tokenSupplyType)))
}
27 changes: 27 additions & 0 deletions sdk/token_supply_type_unit_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//go:build all || unit

package hiero

// SPDX-License-Identifier: Apache-2.0

import (
"testing"

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

func TestUnitTokenSupplyTypeString(t *testing.T) {
t.Parallel()

tests := []struct {
supplyType TokenSupplyType
expected string
}{
{TokenSupplyTypeInfinite, "TOKEN_SUPPLY_TYPE_INFINITE"},
{TokenSupplyTypeFinite, "TOKEN_SUPPLY_TYPE_FINITE"},
}

for _, tt := range tests {
assert.Equal(t, tt.expected, tt.supplyType.String())
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a panic-path test? PanicsWithValue asserts the exact message, so it covers the branch actually changed and would've failed on the old TokenType.String() text.

Loading