Expand available path categories (#733)
## Description Add events and contacts. Still cannot create paths of these types though. ## Type of change Please check the type of change your PR introduces: - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [x] 🐹 Trivial/Minor ## Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> #671 ## Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
61ce920972
commit
e325e36c04
@ -10,11 +10,13 @@ func _() {
|
||||
var x [1]struct{}
|
||||
_ = x[UnknownCategory-0]
|
||||
_ = x[EmailCategory-1]
|
||||
_ = x[ContactsCategory-2]
|
||||
_ = x[EventsCategory-3]
|
||||
}
|
||||
|
||||
const _CategoryType_name = "UnknownCategoryemail"
|
||||
const _CategoryType_name = "UnknownCategoryemailcontactsevents"
|
||||
|
||||
var _CategoryType_index = [...]uint8{0, 15, 20}
|
||||
var _CategoryType_index = [...]uint8{0, 15, 20, 28, 34}
|
||||
|
||||
func (i CategoryType) String() string {
|
||||
if i < 0 || i >= CategoryType(len(_CategoryType_index)-1) {
|
||||
|
||||
@ -27,14 +27,20 @@ type CategoryType int
|
||||
|
||||
//go:generate stringer -type=CategoryType -linecomment
|
||||
const (
|
||||
UnknownCategory CategoryType = iota
|
||||
EmailCategory // email
|
||||
UnknownCategory CategoryType = iota
|
||||
EmailCategory // email
|
||||
ContactsCategory // contacts
|
||||
EventsCategory // events
|
||||
)
|
||||
|
||||
func toCategoryType(category string) CategoryType {
|
||||
switch category {
|
||||
case EmailCategory.String():
|
||||
return EmailCategory
|
||||
case ContactsCategory.String():
|
||||
return ContactsCategory
|
||||
case EventsCategory.String():
|
||||
return EventsCategory
|
||||
default:
|
||||
return UnknownCategory
|
||||
}
|
||||
@ -43,7 +49,9 @@ func toCategoryType(category string) CategoryType {
|
||||
// serviceCategories is a mapping of all valid service/category pairs.
|
||||
var serviceCategories = map[ServiceType]map[CategoryType]struct{}{
|
||||
ExchangeService: {
|
||||
EmailCategory: {},
|
||||
EmailCategory: {},
|
||||
ContactsCategory: {},
|
||||
EventsCategory: {},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -81,6 +81,22 @@ func (suite *ServiceCategoryUnitSuite) TestValidateServiceAndCategory() {
|
||||
expectedCategory: EmailCategory,
|
||||
check: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "ExchangeContacts",
|
||||
service: ExchangeService.String(),
|
||||
category: ContactsCategory.String(),
|
||||
expectedService: ExchangeService,
|
||||
expectedCategory: ContactsCategory,
|
||||
check: assert.NoError,
|
||||
},
|
||||
{
|
||||
name: "ExchangeEvents",
|
||||
service: ExchangeService.String(),
|
||||
category: EventsCategory.String(),
|
||||
expectedService: ExchangeService,
|
||||
expectedCategory: EventsCategory,
|
||||
check: assert.NoError,
|
||||
},
|
||||
}
|
||||
for _, test := range table {
|
||||
suite.T().Run(test.name, func(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user