corso/src/pkg/errs/errs_test.go
Keepers 30fa43ab12
rename package to avoid varname shadowing (#3079)
#### Type of change

- [x] 🧹 Tech Debt/Cleanup
2023-04-10 21:41:11 +00:00

38 lines
856 B
Go

package errs
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/src/internal/connector/graph"
"github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/pkg/repository"
)
type ErrUnitSuite struct {
tester.Suite
}
func TestErrUnitSuite(t *testing.T) {
suite.Run(t, &ErrUnitSuite{Suite: tester.NewUnitSuite(t)})
}
func (suite *ErrUnitSuite) TestIs() {
table := []struct {
is errEnum
input error
}{
{RepoAlreadyExists, repository.ErrorRepoAlreadyExists},
{BackupNotFound, repository.ErrorBackupNotFound},
{ServiceNotEnabled, graph.ErrServiceNotEnabled},
}
for _, test := range table {
suite.Run(string(test.is), func() {
assert.True(suite.T(), Is(test.input, test.is))
assert.False(suite.T(), Is(assert.AnError, test.is))
})
}
}