Skip to content

Commit

Permalink
test: detail error message
Browse files Browse the repository at this point in the history
  • Loading branch information
r3v4s committed Dec 10, 2024
1 parent 40f9b72 commit 7b61cf9
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions _deploy/r/gnoswap/common/grc20reg_helper_test.gno
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ var (
)

func TestGetToken(t *testing.T) {
t.Run("registered(by default)", func(t *testing.T) {
t.Run("get regsitered token", func(t *testing.T) {
token := GetToken(tokenPath)
if token == nil {
t.Error("Expected non-nil teller for foo20")
t.Error("Expected non-nil token for foo20")
}
})

t.Run("not registered", func(t *testing.T) {
t.Run("get non registered token", func(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("Expected panic for non-registered token")
}
}()
GetToken("not_registered")
GetToken("not_registered_token")
})
}

Expand Down Expand Up @@ -75,20 +75,20 @@ func TestTokenMethod(t *testing.T) {
}

func TestGetTokenTeller(t *testing.T) {
t.Run("registered(by default)", func(t *testing.T) {
t.Run("get registered token teller", func(t *testing.T) {
teller := GetTokenTeller(tokenPath)
if teller == nil {
t.Error("Expected non-nil teller for foo20")
}
})

t.Run("not registered", func(t *testing.T) {
t.Run("get non registered token teller", func(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("Expected panic for non-registered token")
}
}()
GetTokenTeller("not_registered")
GetTokenTeller("not_registered_teller")
})
}

Expand Down Expand Up @@ -129,21 +129,21 @@ func TestTellerMethod(t *testing.T) {
}

func TestIsRegistered(t *testing.T) {
t.Run("registered(by default)", func(t *testing.T) {
t.Run("check if token is registered", func(t *testing.T) {
uassert.NoError(t, IsRegistered(tokenPath))
})

t.Run("not registered", func(t *testing.T) {
uassert.Error(t, IsRegistered("not_registered"))
t.Run("check if token is not registered", func(t *testing.T) {
uassert.Error(t, IsRegistered("not_registered_token"))
})
}

func TestMustRegistered(t *testing.T) {
t.Run("registered(by default)", func(t *testing.T) {
t.Run("must be registered", func(t *testing.T) {
MustRegistered(tokenPath)
})

t.Run("not registered", func(t *testing.T) {
t.Run("panic for non registered token", func(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("Expected panic for non-registered token")
Expand Down

0 comments on commit 7b61cf9

Please sign in to comment.