From 8f0a21834e6ce49dc1e3d917fff5f67bbe5dd986 Mon Sep 17 00:00:00 2001 From: Michael Brooks Date: Mon, 19 Oct 2026 11:17:05 -0600 Subject: [PATCH] refactor: remove unused Trigger.IsKnownType method --- internal/shared/types/triggers.go | 16 ------- internal/shared/types/triggers_test.go | 63 -------------------------- 2 files changed, 79 deletions(-) delete mode 100644 internal/shared/types/triggers_test.go diff --git a/internal/shared/types/triggers.go b/internal/shared/types/triggers.go index e0b5d07a..ef13e666 100644 --- a/internal/shared/types/triggers.go +++ b/internal/shared/types/triggers.go @@ -42,22 +42,6 @@ type Trigger struct { RawMessage json.RawMessage `json:"-" yaml:"-"` // "-" will always omit } -// IsKnownType returns true if Trigger.Type is a known and supported type -func (t *Trigger) IsKnownType() bool { - switch t.Type { - case - TriggerTypeShortcut, - TriggerTypeSlashCommand, - TriggerTypeMessageShortcut, - TriggerTypeEvent, - TriggerTypeWebhook, - TriggerTypeScheduled: - return true - default: - return false - } -} - // TriggerDefinition type is returned by the SDK hook 'triggers' type TriggerDefinition struct { Key string `json:"key" yaml:"key"` diff --git a/internal/shared/types/triggers_test.go b/internal/shared/types/triggers_test.go deleted file mode 100644 index 53a3f965..00000000 --- a/internal/shared/types/triggers_test.go +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022-2026 Salesforce, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package types - -import ( - "testing" - - "github.com/stretchr/testify/require" -) - -func Test_Triggers_IsKnownType(t *testing.T) { - tests := map[string]struct { - trigger *Trigger - expectedBool bool - }{ - "Trigger type is TriggerTypeShortcut": { - trigger: &Trigger{Type: TriggerTypeShortcut}, - expectedBool: true, - }, - "Trigger type is TriggerTypeSlashCommand": { - trigger: &Trigger{Type: TriggerTypeSlashCommand}, - expectedBool: true, - }, - "Trigger type is TriggerTypeMessageShortcut": { - trigger: &Trigger{Type: TriggerTypeMessageShortcut}, - expectedBool: true, - }, - "Trigger type is TriggerTypeEvent": { - trigger: &Trigger{Type: TriggerTypeEvent}, - expectedBool: true, - }, - "Trigger type is TriggerTypeWebhook": { - trigger: &Trigger{Type: TriggerTypeWebhook}, - expectedBool: true, - }, - "Trigger type is TriggerTypeScheduled": { - trigger: &Trigger{Type: TriggerTypeScheduled}, - expectedBool: true, - }, - "Trigger type is invalid": { - trigger: &Trigger{Type: "pickle pie"}, - expectedBool: false, - }, - } - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - returnedBool := tc.trigger.IsKnownType() - require.Equal(t, tc.expectedBool, returnedBool) - }) - } -}