package helpers import ( "testing" "github.com/go-playground/locales/ru" ut "github.com/go-playground/universal-translator" "github.com/go-playground/validator/v10" "github.com/stretchr/testify/assert" ) func Test_GetDefaultTranslator(t *testing.T) { var ( validate = validator.New() localeRu = ru.New() uniTrans = ut.New(localeRu, localeRu) translator, _ = uniTrans.GetTranslator(localeRu.Locale()) ) tests := []struct { name string req *validator.Validate res ut.Translator err error }{ { name: "positive case", req: validate, res: translator, err: nil, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { res, err := GetDefaultTranslator(tt.req) assert.IsType(t, tt.res, res) assert.Equal(t, tt.err, err) }) } }