Use suite wrapper in internal/common package (#2527)
## Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No ## Type of change - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [x] 🤖 Test - [ ] 💻 CI/Deployment - [x] 🧹 Tech Debt/Cleanup ## Issue(s) * #2373 ## Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
efe1b6292d
commit
034ee0df39
@ -7,14 +7,16 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommonBucketsSuite struct {
|
type CommonBucketsSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommonBucketsSuite(t *testing.T) {
|
func TestCommonBucketsSuite(t *testing.T) {
|
||||||
suite.Run(t, new(CommonBucketsSuite))
|
s := &CommonBucketsSuite{Suite: tester.NewUnitSuite(t)}
|
||||||
|
suite.Run(t, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *CommonBucketsSuite) TestBucketPrefix() {
|
func (suite *CommonBucketsSuite) TestBucketPrefix() {
|
||||||
|
|||||||
@ -7,14 +7,16 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommonConfigsSuite struct {
|
type CommonConfigsSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommonConfigsSuite(t *testing.T) {
|
func TestCommonConfigsSuite(t *testing.T) {
|
||||||
suite.Run(t, new(CommonConfigsSuite))
|
s := &CommonConfigsSuite{Suite: tester.NewUnitSuite(t)}
|
||||||
|
suite.Run(t, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -52,7 +54,9 @@ func (suite *CommonConfigsSuite) TestUnionConfigs_string() {
|
|||||||
{"fc error", stringConfig{keyExpect, nil}, stringConfig2{keyExpect2, assert.AnError}, assert.Error},
|
{"fc error", stringConfig{keyExpect, nil}, stringConfig2{keyExpect2, assert.AnError}, assert.Error},
|
||||||
}
|
}
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.T().Run(test.name, func(t *testing.T) {
|
suite.Run(test.name, func() {
|
||||||
|
t := suite.T()
|
||||||
|
|
||||||
cs, err := common.UnionStringConfigs(test.ac, test.bc)
|
cs, err := common.UnionStringConfigs(test.ac, test.bc)
|
||||||
test.errCheck(t, err)
|
test.errCheck(t, err)
|
||||||
// remaining tests depend on error-free state
|
// remaining tests depend on error-free state
|
||||||
|
|||||||
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testErr struct {
|
type testErr struct {
|
||||||
@ -20,11 +21,12 @@ type testErr2 struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ErrorsUnitSuite struct {
|
type ErrorsUnitSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestErrorsUnitSuite(t *testing.T) {
|
func TestErrorsUnitSuite(t *testing.T) {
|
||||||
suite.Run(t, new(ErrorsUnitSuite))
|
s := &ErrorsUnitSuite{Suite: tester.NewUnitSuite(t)}
|
||||||
|
suite.Run(t, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *ErrorsUnitSuite) TestPropagatesCause() {
|
func (suite *ErrorsUnitSuite) TestPropagatesCause() {
|
||||||
|
|||||||
@ -8,14 +8,16 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/ptr"
|
"github.com/alcionai/corso/src/internal/common/ptr"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PointerSuite struct {
|
type PointerSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestPointerSuite(t *testing.T) {
|
func TestPointerSuite(t *testing.T) {
|
||||||
suite.Run(t, new(PointerSuite))
|
s := &PointerSuite{Suite: tester.NewUnitSuite(t)}
|
||||||
|
suite.Run(t, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestVal checks to ptr derefencing for the
|
// TestVal checks to ptr derefencing for the
|
||||||
|
|||||||
@ -7,14 +7,16 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommonSlicesSuite struct {
|
type CommonSlicesSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommonSlicesSuite(t *testing.T) {
|
func TestCommonSlicesSuite(t *testing.T) {
|
||||||
suite.Run(t, new(CommonSlicesSuite))
|
s := &CommonSlicesSuite{Suite: tester.NewUnitSuite(t)}
|
||||||
|
suite.Run(t, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *CommonSlicesSuite) TestContainsString() {
|
func (suite *CommonSlicesSuite) TestContainsString() {
|
||||||
|
|||||||
@ -9,14 +9,16 @@ import (
|
|||||||
"github.com/stretchr/testify/suite"
|
"github.com/stretchr/testify/suite"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common"
|
"github.com/alcionai/corso/src/internal/common"
|
||||||
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
)
|
)
|
||||||
|
|
||||||
type CommonTimeUnitSuite struct {
|
type CommonTimeUnitSuite struct {
|
||||||
suite.Suite
|
tester.Suite
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCommonTimeUnitSuite(t *testing.T) {
|
func TestCommonTimeUnitSuite(t *testing.T) {
|
||||||
suite.Run(t, new(CommonTimeUnitSuite))
|
s := &CommonTimeUnitSuite{Suite: tester.NewUnitSuite(t)}
|
||||||
|
suite.Run(t, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *CommonTimeUnitSuite) TestFormatTime() {
|
func (suite *CommonTimeUnitSuite) TestFormatTime() {
|
||||||
@ -145,7 +147,9 @@ func (suite *CommonTimeUnitSuite) TestExtractTime() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
suite.T().Run(test.input, func(t *testing.T) {
|
suite.Run(test.input, func() {
|
||||||
|
t := suite.T()
|
||||||
|
|
||||||
result, err := common.ExtractTime(test.input)
|
result, err := common.ExtractTime(test.input)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, test.expect, comparable(t, result, test.clippedFormat))
|
assert.Equal(t, test.expect, comparable(t, result, test.clippedFormat))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user