mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-14 15:09:51 +00:00
* 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
33 lines
725 B
Go
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)
|
|
}
|