Skip to content
Merged
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
28 changes: 28 additions & 0 deletions contract/cache_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package contract_test

import (
"testing"

"github.com/stretchr/testify/require"
"github.com/studiolambda/cosmos/contract"
)

func TestErrCacheKeyNotFoundMessage(t *testing.T) {
require.Equal(t, "cache key not found", contract.ErrCacheKeyNotFound.Error())
}

func TestErrCacheKeyNotFoundIsNonNil(t *testing.T) {
require.NotNil(t, contract.ErrCacheKeyNotFound)
}

func TestErrCacheUnsupportedOperationMessage(t *testing.T) {
require.Equal(
t,
"cache unsupported operation",
contract.ErrCacheUnsupportedOperation.Error(),
)
}

func TestErrCacheUnsupportedOperationIsNonNil(t *testing.T) {
require.NotNil(t, contract.ErrCacheUnsupportedOperation)
}
32 changes: 32 additions & 0 deletions contract/database_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package contract_test

import (
"testing"

"github.com/stretchr/testify/require"
"github.com/studiolambda/cosmos/contract"
)

func TestErrDatabaseNoRowsMessage(t *testing.T) {
require.Equal(
t,
"no database rows were found",
contract.ErrDatabaseNoRows.Error(),
)
}

func TestErrDatabaseNoRowsIsNonNil(t *testing.T) {
require.NotNil(t, contract.ErrDatabaseNoRows)
}

func TestErrDatabaseNestedTransactionMessage(t *testing.T) {
require.Equal(
t,
"nested transactions are not supported",
contract.ErrDatabaseNestedTransaction.Error(),
)
}

func TestErrDatabaseNestedTransactionIsNonNil(t *testing.T) {
require.NotNil(t, contract.ErrDatabaseNestedTransaction)
}
18 changes: 18 additions & 0 deletions contract/hooks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package contract_test

import (
"testing"

"github.com/stretchr/testify/require"
"github.com/studiolambda/cosmos/contract"
)

func TestHooksKeyIsNonNil(t *testing.T) {
require.NotNil(t, contract.HooksKey)
}

func TestHooksKeyIsDistinctType(t *testing.T) {
var other any = struct{}{}

require.NotEqual(t, other, contract.HooksKey)
}
Loading
Loading