From 1acfca9726e049dd900200280427c2efb9dcb964 Mon Sep 17 00:00:00 2001 From: Neur0toxine Date: Tue, 17 Dec 2024 14:07:33 +0300 Subject: [PATCH] add testifylint --- .golangci.yml | 3 ++- core/validator_test.go | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 29d2a6c..c6e33a8 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -42,6 +42,7 @@ linters: - unconvert - whitespace - unused + - testifylint linters-settings: govet: @@ -188,4 +189,4 @@ severity: case-sensitive: false service: - golangci-lint-version: 1.55.x \ No newline at end of file + golangci-lint-version: 1.62.x \ No newline at end of file diff --git a/core/validator_test.go b/core/validator_test.go index a260f03..4e23ccf 100644 --- a/core/validator_test.go +++ b/core/validator_test.go @@ -5,8 +5,6 @@ import ( "github.com/gin-gonic/gin/binding" "github.com/go-playground/validator/v10" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" "github.com/retailcrm/mg-transport-core/v2/core/db/models" @@ -43,7 +41,7 @@ func (s *ValidatorSuite) getError(err error) string { } func (s *ValidatorSuite) Test_ValidationInvalidType() { - assert.IsType(s.T(), &validator.InvalidValidationError{}, s.engine.Struct(nil)) + s.Assert().IsType(&validator.InvalidValidationError{}, s.engine.Struct(nil)) } func (s *ValidatorSuite) Test_ValidationFails() { @@ -62,10 +60,9 @@ func (s *ValidatorSuite) Test_ValidationFails() { } err := s.engine.Struct(conn) - require.IsType(s.T(), validator.ValidationErrors{}, err) + s.Require().IsType(validator.ValidationErrors{}, err) - assert.Equal( - s.T(), + s.Assert().Equal( "Key: 'Connection.URL' Error:Field validation for 'URL' failed on the 'validateCrmURL' tag", s.getError(err)) } @@ -92,6 +89,6 @@ func (s *ValidatorSuite) Test_ValidationSuccess() { } err := s.engine.Struct(conn) - assert.NoError(s.T(), err, domain+": "+s.getError(err)) + s.Assert().NoError(err, domain+": "+s.getError(err)) } }