Files
gocryptotrader/gctscript/modules/gct/errors_test.go
Adrian Gallagher 19b8957f3f codebase: Replace !errors.Is(err, target) with testify (#1931)
* tests: Replace !errors.Is(err, target) with testify equivalents

* codebase: Manual !errors.Is(err, target) replacements

* typo: Replace errMisMatchedEvent with errMismatchedEvent

* tests: Enhance error messages for better output

* tests: Refactor error assertions in various test cases to use require and improve clarity

* misc linter: Fix assert should wording

* tests: Simplify assertions in TestCreateSignals for clarity and conciseness

* tests: Enhance assertion message in TestCreateSignals
2025-06-10 16:29:57 +10:00

33 lines
725 B
Go

package gct
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/thrasher-corp/gocryptotrader/common"
)
func TestErrorResponse(t *testing.T) {
t.Parallel()
_, err := errorResponsef("")
require.ErrorIs(t, err, errFormatStringIsEmpty)
_, err = errorResponsef("--")
require.ErrorIs(t, err, errNoArguments)
errResp, err := errorResponsef("error %s", "hello")
if err != nil {
t.Fatal(err)
}
if errResp.String() != `error: "error hello"` {
t.Fatalf("received: %v but expected: %v", errResp.String(), `error: "error hello"`)
}
}
func TestConstructRuntimeError(t *testing.T) {
t.Parallel()
err := constructRuntimeError(0, "", "", nil)
require.ErrorIs(t, err, common.ErrTypeAssertFailure)
}