mirror of
https://github.com/retailcrm/mg-transport-core.git
synced 2025-04-01 20:36:11 +03:00
add testifylint
This commit is contained in:
parent
970e056c76
commit
1acfca9726
2 changed files with 6 additions and 8 deletions
|
@ -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
|
||||
golangci-lint-version: 1.62.x
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue