File tree 3 files changed +38
-1
lines changed
3 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,16 @@ func (suite *BranchValidatorTestSuite) TestValidate_WhenPassedBranchesAreValid_S
30
30
suite .Nil (err )
31
31
}
32
32
33
- func (suite * BranchValidatorTestSuite ) TestValidate_WhenPassedEmptyStringIsPassed_ShouldReturnEmptybranchError () {
33
+ func (suite * BranchValidatorTestSuite ) TestValidate_WhenNoBranchesArePassed_ShouldReturnEmptyBranchError () {
34
34
err := suite .branchValidator .ValidateWithFields ()
35
35
36
36
suite .NotNil (err )
37
37
suite .Equal (EmptyBranchName , err )
38
38
}
39
+
40
+ func (suite * BranchValidatorTestSuite ) TestValidate_WhenEmptyStringIsPassed_ShouldReturnEmptyBranchError () {
41
+ err := suite .branchValidator .ValidateWithFields ("" )
42
+
43
+ suite .NotNil (err )
44
+ suite .Equal (EmptyBranchName , err )
45
+ }
Original file line number Diff line number Diff line change @@ -42,3 +42,12 @@ func (suite *RepoValidatorTestSuite) TestValidate_WhenRepoIsNil_ShouldReturnRepo
42
42
suite .NotNil (err )
43
43
suite .Equal (NilRepoError , err )
44
44
}
45
+
46
+ func (suite * RepoValidatorTestSuite ) TestValidate_WhenWrongTypeOfInputIsPassed_ShouldReturnRepoNilError () {
47
+ suite .repoValidator = NewRepoValidator ()
48
+
49
+ err := suite .repoValidator .Validate ("nil" )
50
+
51
+ suite .NotNil (err )
52
+ suite .Equal (NilRepoError , err )
53
+ }
Original file line number Diff line number Diff line change
1
+ package validator
2
+
3
+ import (
4
+ "github.com/stretchr/testify/suite"
5
+ "testing"
6
+ )
7
+
8
+ type ValidationErrorTestSuite struct {
9
+ suite.Suite
10
+ validationError Error
11
+ }
12
+
13
+ func TestValidationErrorTestSuite (t * testing.T ) {
14
+ suite .Run (t , new (ValidationErrorTestSuite ))
15
+ }
16
+
17
+ func (suite * ValidationErrorTestSuite ) TestError_ShouldReturnErrorString () {
18
+ suite .validationError = NilRepoError
19
+
20
+ suite .Equal ("Repo is nil" , suite .validationError .Error ())
21
+ }
You can’t perform that action at this time.
0 commit comments