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:
ashmrtn 2022-09-01 17:55:53 -07:00 committed by GitHub
parent 61ce920972
commit e325e36c04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 5 deletions

View File

@ -10,11 +10,13 @@ func _() {
var x [1]struct{} var x [1]struct{}
_ = x[UnknownCategory-0] _ = x[UnknownCategory-0]
_ = x[EmailCategory-1] _ = 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 { func (i CategoryType) String() string {
if i < 0 || i >= CategoryType(len(_CategoryType_index)-1) { if i < 0 || i >= CategoryType(len(_CategoryType_index)-1) {

View File

@ -27,14 +27,20 @@ type CategoryType int
//go:generate stringer -type=CategoryType -linecomment //go:generate stringer -type=CategoryType -linecomment
const ( const (
UnknownCategory CategoryType = iota UnknownCategory CategoryType = iota
EmailCategory // email EmailCategory // email
ContactsCategory // contacts
EventsCategory // events
) )
func toCategoryType(category string) CategoryType { func toCategoryType(category string) CategoryType {
switch category { switch category {
case EmailCategory.String(): case EmailCategory.String():
return EmailCategory return EmailCategory
case ContactsCategory.String():
return ContactsCategory
case EventsCategory.String():
return EventsCategory
default: default:
return UnknownCategory return UnknownCategory
} }
@ -43,7 +49,9 @@ func toCategoryType(category string) CategoryType {
// serviceCategories is a mapping of all valid service/category pairs. // serviceCategories is a mapping of all valid service/category pairs.
var serviceCategories = map[ServiceType]map[CategoryType]struct{}{ var serviceCategories = map[ServiceType]map[CategoryType]struct{}{
ExchangeService: { ExchangeService: {
EmailCategory: {}, EmailCategory: {},
ContactsCategory: {},
EventsCategory: {},
}, },
} }

View File

@ -81,6 +81,22 @@ func (suite *ServiceCategoryUnitSuite) TestValidateServiceAndCategory() {
expectedCategory: EmailCategory, expectedCategory: EmailCategory,
check: assert.NoError, 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 { for _, test := range table {
suite.T().Run(test.name, func(t *testing.T) { suite.T().Run(test.name, func(t *testing.T) {