From 11aa4f78cb6028b18e37ba3b67832b58b1643c7a Mon Sep 17 00:00:00 2001 From: Michael Brooks Date: Tue, 27 Jan 2026 19:31:47 -0800 Subject: [PATCH] refactor(tests): use tests/tc naming in table tests using the slice pattern --- internal/api/app_test.go | 10 +-- internal/api/debug_test.go | 8 +-- internal/app/app_client_test.go | 6 +- internal/app/app_test.go | 8 +-- internal/goutils/slices_test.go | 16 ++--- internal/goutils/strings_test.go | 50 +++++++------- .../prompt_provider_auth_select_test.go | 12 ++-- .../prompt_provider_select_test.go | 12 ++-- .../externalauth/prompt_token_select_test.go | 8 +-- .../prompt_workflow_select_test.go | 8 +-- internal/pkg/platform/activity_test.go | 8 +-- internal/runtime/deno/deno_test.go | 68 +++++++++---------- internal/runtime/node/node_test.go | 52 +++++++------- internal/runtime/python/python_test.go | 56 +++++++-------- internal/runtime/runtime_test.go | 16 ++--- internal/shared/types/app_manifest_test.go | 10 +-- internal/shared/types/auth_test.go | 18 ++--- internal/shared/types/channel_test.go | 6 +- internal/shared/types/icon_test.go | 20 +++--- internal/shared/types/permissions_test.go | 58 ++++++++-------- internal/shared/types/team_test.go | 8 +-- internal/shared/types/triggers_test.go | 8 +-- internal/shared/types/user_test.go | 16 ++--- 23 files changed, 241 insertions(+), 241 deletions(-) diff --git a/internal/api/app_test.go b/internal/api/app_test.go index 26d44d4a..ae14caf7 100644 --- a/internal/api/app_test.go +++ b/internal/api/app_test.go @@ -484,8 +484,8 @@ func TestClient_DeveloperAppInstall_RequestAppApproval(t *testing.T) { requestJSON: `{"app":"A1234","reason":"This request has been automatically generated according to project environment settings."}`, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { ctx := slackcontext.MockContext(t.Context()) // prepare @@ -495,14 +495,14 @@ func TestClient_DeveloperAppInstall_RequestAppApproval(t *testing.T) { result := fmt.Sprintf( `{"ok":false,"error":"%s","team_id":"%s"}`, slackerror.ErrAppApprovalRequestEligible, - tt.teamID, + tc.teamID, ) _, err := fmt.Fprintln(w, result) require.NoError(t, err) } if strings.Contains(r.URL.Path, appApprovalRequestCreateMethod) { - expectedJSON := tt.requestJSON + expectedJSON := tc.requestJSON payload, err := io.ReadAll(r.Body) require.NoError(t, err) require.Equal(t, expectedJSON, string(payload)) @@ -518,7 +518,7 @@ func TestClient_DeveloperAppInstall_RequestAppApproval(t *testing.T) { iostreamMock.On("PrintTrace", mock.Anything, mock.Anything, mock.Anything).Return() // execute - _, _, err := c.DeveloperAppInstall(ctx, iostreamMock, "token", tt.app, []string{}, []string{}, tt.orgGrantWorkspaceID, true) + _, _, err := c.DeveloperAppInstall(ctx, iostreamMock, "token", tc.app, []string{}, []string{}, tc.orgGrantWorkspaceID, true) require.NoError(t, err) }) } diff --git a/internal/api/debug_test.go b/internal/api/debug_test.go index fb8722bc..d166bde1 100644 --- a/internal/api/debug_test.go +++ b/internal/api/debug_test.go @@ -105,10 +105,10 @@ func Test_RedactPII(t *testing.T) { expected: `Operating System (OS): darwin`, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - redacted := goutils.RedactPII(tt.text) - require.Equal(t, redacted, tt.expected) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + redacted := goutils.RedactPII(tc.text) + require.Equal(t, redacted, tc.expected) }) } } diff --git a/internal/app/app_client_test.go b/internal/app/app_client_test.go index 1a55c7cd..805e39ab 100644 --- a/internal/app/app_client_test.go +++ b/internal/app/app_client_test.go @@ -692,14 +692,14 @@ func TestAppClient_CleanupAppsJSONFiles(t *testing.T) { }, } - for _, tt := range tests { + for _, tc := range tests { ac, _, _, pathToAppsJSON, pathToDevAppsJSON, teardown := setup(t) defer teardown(t) ctx := slackcontext.MockContext(t.Context()) - err := afero.WriteFile(ac.fs, pathToAppsJSON, tt.appsJSON, 0600) + err := afero.WriteFile(ac.fs, pathToAppsJSON, tc.appsJSON, 0600) require.NoError(t, err) - err = afero.WriteFile(ac.fs, pathToDevAppsJSON, tt.devAppsJSON, 0600) + err = afero.WriteFile(ac.fs, pathToDevAppsJSON, tc.devAppsJSON, 0600) require.NoError(t, err) _, err = ac.fs.Stat(pathToAppsJSON) diff --git a/internal/app/app_test.go b/internal/app/app_test.go index f4f374fc..4976f34c 100644 --- a/internal/app/app_test.go +++ b/internal/app/app_test.go @@ -159,10 +159,10 @@ func Test_RegexReplaceAppNameInManifest(t *testing.T) { expectedSrc: testdata.ManifestSDKTSAppName, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualSrc := regexReplaceAppNameInManifest(tt.src, tt.appName) - require.Equal(t, tt.expectedSrc, actualSrc) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualSrc := regexReplaceAppNameInManifest(tc.src, tc.appName) + require.Equal(t, tc.expectedSrc, actualSrc) }) } } diff --git a/internal/goutils/slices_test.go b/internal/goutils/slices_test.go index 4c1a28d7..7527543d 100644 --- a/internal/goutils/slices_test.go +++ b/internal/goutils/slices_test.go @@ -46,10 +46,10 @@ func Test_AppendStringIfNotMember(t *testing.T) { expectedSlice: []string{"one"}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualSlice := AppendStringIfNotMember(tt.originalSlice, tt.newElement) - require.ElementsMatch(t, tt.expectedSlice, actualSlice) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualSlice := AppendStringIfNotMember(tc.originalSlice, tc.newElement) + require.ElementsMatch(t, tc.expectedSlice, actualSlice) }) } } @@ -68,10 +68,10 @@ func Test_Contains(t *testing.T) { {name: "not_case_sensitive_fail", listToCheck: []string{"hi", "hey", "hello", "apple", "pear"}, toFind: "Peach", isCaseSensitive: false, want: false}, {name: "not_case_sensitive_substring", listToCheck: []string{"hi", "hey hello"}, toFind: "hey", isCaseSensitive: false, want: false}, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := Contains(tt.listToCheck, tt.toFind, tt.isCaseSensitive); got != tt.want { - t.Errorf("method() = %v, want %v", got, tt.want) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + if got := Contains(tc.listToCheck, tc.toFind, tc.isCaseSensitive); got != tc.want { + t.Errorf("method() = %v, want %v", got, tc.want) } }) } diff --git a/internal/goutils/strings_test.go b/internal/goutils/strings_test.go index 938f5f8a..2d4ef724 100644 --- a/internal/goutils/strings_test.go +++ b/internal/goutils/strings_test.go @@ -53,11 +53,11 @@ func Test_HashString(t *testing.T) { expected: true, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - hash1, err1 := HashString(tt.text1) - hash2, err2 := HashString(tt.text2) - require.Equal(t, hash1 == hash2, tt.expected) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + hash1, err1 := HashString(tc.text1) + hash2, err2 := HashString(tc.text2) + require.Equal(t, hash1 == hash2, tc.expected) require.NoError(t, err1) require.NoError(t, err2) }) @@ -121,10 +121,10 @@ func Test_ExtractFirstJSONFromString(t *testing.T) { expected: "", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualRes := ExtractFirstJSONFromString(tt.text) - require.Equal(t, tt.expected, actualRes) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualRes := ExtractFirstJSONFromString(tc.text) + require.Equal(t, tc.expected, actualRes) }) } } @@ -155,10 +155,10 @@ func Test_addLogWhenValExist(t *testing.T) { expected: "hello world: [slack]\n", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - output := AddLogWhenValExist(tt.title, tt.val) - require.Equal(t, output, tt.expected) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + output := AddLogWhenValExist(tc.title, tc.val) + require.Equal(t, output, tc.expected) }) } } @@ -380,10 +380,10 @@ func Test_RedactPII(t *testing.T) { expected: `slack variables remove ...`, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - redacted := RedactPII(tt.text) - require.Equal(t, tt.expected, redacted) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + redacted := RedactPII(tc.text) + require.Equal(t, tc.expected, redacted) }) } } @@ -414,10 +414,10 @@ func Test_UpperCaseTrimAll(t *testing.T) { expected: "HELLO,WORLD", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - output := UpperCaseTrimAll(tt.namedEntities) - require.Equal(t, output, tt.expected) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + output := UpperCaseTrimAll(tc.namedEntities) + require.Equal(t, output, tc.expected) }) } } @@ -444,10 +444,10 @@ func Test_ToHTTPS(t *testing.T) { expected: "https://www.xyz.com", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - output := ToHTTPS(tt.urlAddr) - require.Equal(t, output, tt.expected) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + output := ToHTTPS(tc.urlAddr) + require.Equal(t, output, tc.expected) }) } } diff --git a/internal/pkg/externalauth/prompt_provider_auth_select_test.go b/internal/pkg/externalauth/prompt_provider_auth_select_test.go index 843b4916..38c18559 100644 --- a/internal/pkg/externalauth/prompt_provider_auth_select_test.go +++ b/internal/pkg/externalauth/prompt_provider_auth_select_test.go @@ -82,18 +82,18 @@ func TestPrompt_ProviderAuthSelectPrompt_no_selected_auth(t *testing.T) { }, } - for _, tt := range tests { + for _, tc := range tests { var mockProviderFlag string ctx := slackcontext.MockContext(t.Context()) clientsMock := shared.NewClientsMock() clients := shared.NewClientFactory(clientsMock.MockClientFactory()) clientsMock.Config.Flags.StringVar(&mockProviderFlag, "provider", "", "mock provider flag") - if tt.ProviderFlag != "" { - _ = clientsMock.Config.Flags.Set("provider", tt.ProviderFlag) + if tc.ProviderFlag != "" { + _ = clientsMock.Config.Flags.Set("provider", tc.ProviderFlag) } clientsMock.IO.On("SelectPrompt", mock.Anything, "Select a provider", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{ Flag: clients.Config.Flags.Lookup("provider"), - })).Return(tt.Selection, nil) + })).Return(tc.Selection, nil) clientsMock.AddDefaultMocks() @@ -149,7 +149,7 @@ func TestPrompt_ProviderAuthSelectPrompt_with_selected_auth(t *testing.T) { }, } - for _, tt := range tests { + for _, tc := range tests { var mockProviderFlag string ctx := slackcontext.MockContext(t.Context()) clientsMock := shared.NewClientsMock() @@ -157,7 +157,7 @@ func TestPrompt_ProviderAuthSelectPrompt_with_selected_auth(t *testing.T) { clientsMock.Config.Flags.StringVar(&mockProviderFlag, "provider", "", "mock provider flag") clientsMock.IO.On("SelectPrompt", mock.Anything, "Select a provider", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{ Flag: clientsMock.Config.Flags.Lookup("provider"), - })).Return(tt.Selection, nil) + })).Return(tc.Selection, nil) clientsMock.AddDefaultMocks() selectedProvider, err := ProviderAuthSelectPrompt(ctx, clients, workflowsInfo) diff --git a/internal/pkg/externalauth/prompt_provider_select_test.go b/internal/pkg/externalauth/prompt_provider_select_test.go index 9dac701e..9d42dfbb 100644 --- a/internal/pkg/externalauth/prompt_provider_select_test.go +++ b/internal/pkg/externalauth/prompt_provider_select_test.go @@ -72,7 +72,7 @@ func TestPrompt_ProviderSelectPrompt_no_token(t *testing.T) { }, } - for _, tt := range tests { + for _, tc := range tests { var mockProviderFlag string ctx := slackcontext.MockContext(t.Context()) clientsMock := shared.NewClientsMock() @@ -80,7 +80,7 @@ func TestPrompt_ProviderSelectPrompt_no_token(t *testing.T) { clientsMock.Config.Flags.StringVar(&mockProviderFlag, "provider", "", "mock provider flag") clientsMock.IO.On("SelectPrompt", mock.Anything, "Select a provider", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{ Flag: clientsMock.Config.Flags.Lookup("provider"), - })).Return(tt.Selection, nil) + })).Return(tc.Selection, nil) clientsMock.AddDefaultMocks() selectedProvider, err := ProviderSelectPrompt(ctx, clients, authorizationInfoLists) @@ -134,18 +134,18 @@ func TestPrompt_ProviderSelectPrompt_with_token(t *testing.T) { }, } - for _, tt := range tests { + for _, tc := range tests { var mockProviderFlag string ctx := slackcontext.MockContext(t.Context()) clientsMock := shared.NewClientsMock() clients := shared.NewClientFactory(clientsMock.MockClientFactory()) clientsMock.Config.Flags.StringVar(&mockProviderFlag, "provider", "", "mock provider flag") - if tt.ProviderFlag != "" { - _ = clientsMock.Config.Flags.Set("provider", tt.ProviderFlag) + if tc.ProviderFlag != "" { + _ = clientsMock.Config.Flags.Set("provider", tc.ProviderFlag) } clientsMock.IO.On("SelectPrompt", mock.Anything, "Select a provider", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{ Flag: clientsMock.Config.Flags.Lookup("provider"), - })).Return(tt.Selection, nil) + })).Return(tc.Selection, nil) clientsMock.AddDefaultMocks() selectedProvider, err := ProviderSelectPrompt(ctx, clients, authorizationInfoLists) diff --git a/internal/pkg/externalauth/prompt_token_select_test.go b/internal/pkg/externalauth/prompt_token_select_test.go index b78a260c..3ab25f71 100644 --- a/internal/pkg/externalauth/prompt_token_select_test.go +++ b/internal/pkg/externalauth/prompt_token_select_test.go @@ -82,17 +82,17 @@ func TestPrompt_TokenSelectPrompt_with_token(t *testing.T) { } var externalAccountFlag string - for _, tt := range tests { + for _, tc := range tests { ctx := slackcontext.MockContext(t.Context()) clientsMock := shared.NewClientsMock() clients := shared.NewClientFactory(clientsMock.MockClientFactory()) clientsMock.Config.Flags.StringVar(&externalAccountFlag, "external-account", "", "mock external-account flag") - if tt.ExternalAccountFlag != "" { - _ = clientsMock.Config.Flags.Set("external-account", tt.ExternalAccountFlag) + if tc.ExternalAccountFlag != "" { + _ = clientsMock.Config.Flags.Set("external-account", tc.ExternalAccountFlag) } clientsMock.IO.On("SelectPrompt", mock.Anything, "Select an external account", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{ Flag: clientsMock.Config.Flags.Lookup("external-account"), - })).Return(tt.Selection, nil) + })).Return(tc.Selection, nil) clientsMock.AddDefaultMocks() selectedToken, err := TokenSelectPrompt(ctx, clients, authorizationInfo) diff --git a/internal/pkg/externalauth/prompt_workflow_select_test.go b/internal/pkg/externalauth/prompt_workflow_select_test.go index f1753aa8..1c2e9eb5 100644 --- a/internal/pkg/externalauth/prompt_workflow_select_test.go +++ b/internal/pkg/externalauth/prompt_workflow_select_test.go @@ -142,18 +142,18 @@ func TestPrompt_WorkflowSelectPrompt_with_workflows(t *testing.T) { }, } - for _, tt := range tests { + for _, tc := range tests { var mockWorkflowFlag string ctx := slackcontext.MockContext(t.Context()) clientsMock := shared.NewClientsMock() clients := shared.NewClientFactory(clientsMock.MockClientFactory()) clientsMock.Config.Flags.StringVar(&mockWorkflowFlag, "workflow", "", "mock workflow flag") - if tt.WorkflowFlag != "" { - _ = clientsMock.Config.Flags.Set("workflow", tt.WorkflowFlag) + if tc.WorkflowFlag != "" { + _ = clientsMock.Config.Flags.Set("workflow", tc.WorkflowFlag) } clientsMock.IO.On("SelectPrompt", mock.Anything, "Select a workflow", mock.Anything, iostreams.MatchPromptConfig(iostreams.SelectPromptConfig{ Flag: clientsMock.Config.Flags.Lookup("workflow"), - })).Return(tt.Selection, nil) + })).Return(tc.Selection, nil) clientsMock.AddDefaultMocks() selectedWorkflow, err := WorkflowSelectPrompt(ctx, clients, authorizationInfoLists) diff --git a/internal/pkg/platform/activity_test.go b/internal/pkg/platform/activity_test.go index de8e2142..7d109951 100644 --- a/internal/pkg/platform/activity_test.go +++ b/internal/pkg/platform/activity_test.go @@ -80,10 +80,10 @@ func Test_prettifyActivity(t *testing.T) { }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - actualResult := prettifyActivity(tt.activity) - for _, expectedResult := range tt.expectedResults { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + actualResult := prettifyActivity(tc.activity) + for _, expectedResult := range tc.expectedResults { require.Contains(t, actualResult, expectedResult) } // Confirm no nil pointers leak to output diff --git a/internal/runtime/deno/deno_test.go b/internal/runtime/deno/deno_test.go index 270f5486..4e507cbf 100644 --- a/internal/runtime/deno/deno_test.go +++ b/internal/runtime/deno/deno_test.go @@ -43,10 +43,10 @@ func Test_Deno_New(t *testing.T) { expectedDeno: &Deno{version: defaultVersion}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { d := New() - require.Equal(t, tt.expectedDeno, d) + require.Equal(t, tc.expectedDeno, d) }) } } @@ -61,10 +61,10 @@ func Test_Deno_IgnoreDirectories(t *testing.T) { expectedIgnoreDirectories: []string{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { d := New() - require.Equal(t, tt.expectedIgnoreDirectories, d.IgnoreDirectories()) + require.Equal(t, tc.expectedIgnoreDirectories, d.IgnoreDirectories()) }) } } @@ -131,15 +131,15 @@ func Test_Deno_InstallProjectDependencies(t *testing.T) { expectedHookExecutorCalls: 1, // Cache dependencies script executed }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) projectDirPath := "/path/to/project-name" fs := slackdeps.NewFsMock() os := slackdeps.NewOsMock() - os.On("LookPath", mock.Anything).Return("", tt.lookPathError) + os.On("LookPath", mock.Anything).Return("", tc.lookPathError) os.AddDefaultMocks() cfg := config.NewConfig(fs, os) @@ -148,10 +148,10 @@ func Test_Deno_InstallProjectDependencies(t *testing.T) { ios.AddDefaultMocks() mockHookExecutor := &hooks.MockHookExecutor{} - mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tt.hookExecutorError) + mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tc.hookExecutorError) // Create files - for _, filePath := range tt.existingFilePaths { + for _, filePath := range tc.existingFilePaths { filePathAbs := filepath.Join(projectDirPath, filePath) // Create the directory if err := fs.MkdirAll(filepath.Dir(filePathAbs), 0755); err != nil { @@ -168,9 +168,9 @@ func Test_Deno_InstallProjectDependencies(t *testing.T) { response, err := d.InstallProjectDependencies(ctx, projectDirPath, mockHookExecutor, ios, fs, os) // Assertions - require.Contains(t, response, tt.expectedResponse) - require.Equal(t, tt.expectedError, err) - mockHookExecutor.AssertNumberOfCalls(t, "Execute", tt.expectedHookExecutorCalls) + require.Contains(t, response, tc.expectedResponse) + require.Equal(t, tc.expectedError, err) + mockHookExecutor.AssertNumberOfCalls(t, "Execute", tc.expectedHookExecutorCalls) }) } } @@ -202,9 +202,9 @@ func Test_Deno_Version(t *testing.T) { expectedVersion: defaultVersion, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expectedVersion, tt.deno.Version()) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.expectedVersion, tc.deno.Version()) }) } } @@ -226,11 +226,11 @@ func Test_Deno_SetVersion(t *testing.T) { expectedVersion: "deno@2", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { d := New() - d.SetVersion(tt.version) - require.Equal(t, tt.expectedVersion, d.Version()) + d.SetVersion(tc.version) + require.Equal(t, tc.expectedVersion, d.Version()) }) } } @@ -252,16 +252,16 @@ func Test_Deno_HooksJSONTemplate(t *testing.T) { expectedErrorType: &json.SyntaxError{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup var anyJSON map[string]interface{} // Test - err := json.Unmarshal(tt.hooksJSONTemplate, &anyJSON) + err := json.Unmarshal(tc.hooksJSONTemplate, &anyJSON) // Assertions - require.IsType(t, tt.expectedErrorType, err) + require.IsType(t, tc.expectedErrorType, err) }) } } @@ -283,8 +283,8 @@ func Test_Deno_PreparePackage(t *testing.T) { expectedPreparePackageError: slackerror.New(slackerror.ErrSDKHookInvocationFailed), }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { ctx := slackcontext.MockContext(t.Context()) // Setup SDKConfig @@ -296,7 +296,7 @@ func Test_Deno_PreparePackage(t *testing.T) { // Setup HookExecutor mockHookExecutor := &hooks.MockHookExecutor{} - mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tt.hookExecutorError) + mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tc.hookExecutorError) // Setup mockOpts := types.PreparePackageOpts{} @@ -309,7 +309,7 @@ func Test_Deno_PreparePackage(t *testing.T) { err := d.PreparePackage(ctx, mockSDKConfig, mockHookExecutor, mockOpts) // Assertions - require.Equal(t, tt.expectedPreparePackageError, err) + require.Equal(t, tc.expectedPreparePackageError, err) }) } } @@ -346,15 +346,15 @@ func Test_Deno_IsRuntimeForProject(t *testing.T) { expectedBool: true, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) fs := slackdeps.NewFsMock() projectDirPath := "/path/to/project-name" // Create files - for _, filePath := range tt.existingFilePaths { + for _, filePath := range tc.existingFilePaths { filePathAbs := filepath.Join(projectDirPath, filePath) // Create the directory if err := fs.MkdirAll(filepath.Dir(filePathAbs), 0755); err != nil { @@ -367,10 +367,10 @@ func Test_Deno_IsRuntimeForProject(t *testing.T) { } // Test - b := IsRuntimeForProject(ctx, fs, projectDirPath, hooks.SDKCLIConfig{Runtime: tt.sdkConfigRuntime}) + b := IsRuntimeForProject(ctx, fs, projectDirPath, hooks.SDKCLIConfig{Runtime: tc.sdkConfigRuntime}) // Assertions - require.Equal(t, tt.expectedBool, b) + require.Equal(t, tc.expectedBool, b) }) } } diff --git a/internal/runtime/node/node_test.go b/internal/runtime/node/node_test.go index 31ca966a..ebfb2e5f 100644 --- a/internal/runtime/node/node_test.go +++ b/internal/runtime/node/node_test.go @@ -42,8 +42,8 @@ func Test_Node_New(t *testing.T) { expectedNode: &Node{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { n := New() require.IsType(t, Node{}, *n) }) @@ -60,10 +60,10 @@ func Test_Node_IgnoreDirectories(t *testing.T) { expectedIgnoreDirectories: []string{"node_modules"}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { n := New() - require.Equal(t, tt.expectedIgnoreDirectories, n.IgnoreDirectories()) + require.Equal(t, tc.expectedIgnoreDirectories, n.IgnoreDirectories()) }) } } @@ -188,8 +188,8 @@ func Test_Node_InstallProjectDependencies(t *testing.T) { }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) projectDirPath := "/path/to/project-name" @@ -200,7 +200,7 @@ func Test_Node_InstallProjectDependencies(t *testing.T) { ios := iostreams.NewIOStreamsMock(cfg, fs, os) mockHookExecutor := &hooks.MockHookExecutor{} - npmMock := tt.npmMock() + npmMock := tc.npmMock() // Test n := New() @@ -208,10 +208,10 @@ func Test_Node_InstallProjectDependencies(t *testing.T) { output, err := n.InstallProjectDependencies(ctx, projectDirPath, mockHookExecutor, ios, fs, os) // Assertions - for _, expectedOutput := range tt.expectedOutputs { + for _, expectedOutput := range tc.expectedOutputs { require.Contains(t, output, expectedOutput) } - require.Equal(t, tt.expectedError, err) + require.Equal(t, tc.expectedError, err) }) } } @@ -231,10 +231,10 @@ func Test_Node_Version(t *testing.T) { expectedVersion: "node", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { n := New() - require.Equal(t, tt.expectedVersion, n.Version()) + require.Equal(t, tc.expectedVersion, n.Version()) }) } } @@ -263,16 +263,16 @@ func Test_Node_HooksJSONTemplate(t *testing.T) { expectedErrorType: &json.SyntaxError{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup var anyJSON map[string]interface{} // Test - err := json.Unmarshal(tt.hooksJSONTemplate, &anyJSON) + err := json.Unmarshal(tc.hooksJSONTemplate, &anyJSON) // Assertions - require.IsType(t, tt.expectedErrorType, err) + require.IsType(t, tc.expectedErrorType, err) }) } } @@ -289,8 +289,8 @@ func Test_Node_PreparePackage(t *testing.T) { expectedPreparePackageError: nil, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { ctx := slackcontext.MockContext(t.Context()) // Setup SDKConfig @@ -302,7 +302,7 @@ func Test_Node_PreparePackage(t *testing.T) { // Setup HookExecutor mockHookExecutor := &hooks.MockHookExecutor{} - mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tt.hookExecutorError) + mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tc.hookExecutorError) // Setup mockOpts := types.PreparePackageOpts{} @@ -315,7 +315,7 @@ func Test_Node_PreparePackage(t *testing.T) { err := d.PreparePackage(ctx, mockSDKConfig, mockHookExecutor, mockOpts) // Assertions - require.Equal(t, tt.expectedPreparePackageError, err) + require.Equal(t, tc.expectedPreparePackageError, err) }) } } @@ -346,15 +346,15 @@ func Test_Node_IsRuntimeForProject(t *testing.T) { expectedBool: true, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) fs := slackdeps.NewFsMock() projectDirPath := "/path/to/project-name" // Create files - for _, filePath := range tt.existingFilePaths { + for _, filePath := range tc.existingFilePaths { filePathAbs := filepath.Join(projectDirPath, filePath) // Create the directory if err := fs.MkdirAll(filepath.Dir(filePathAbs), 0755); err != nil { @@ -367,10 +367,10 @@ func Test_Node_IsRuntimeForProject(t *testing.T) { } // Test - b := IsRuntimeForProject(ctx, fs, projectDirPath, hooks.SDKCLIConfig{Runtime: tt.sdkConfigRuntime}) + b := IsRuntimeForProject(ctx, fs, projectDirPath, hooks.SDKCLIConfig{Runtime: tc.sdkConfigRuntime}) // Assertions - require.Equal(t, tt.expectedBool, b) + require.Equal(t, tc.expectedBool, b) }) } } diff --git a/internal/runtime/python/python_test.go b/internal/runtime/python/python_test.go index 767607ac..bd1ec955 100644 --- a/internal/runtime/python/python_test.go +++ b/internal/runtime/python/python_test.go @@ -41,10 +41,10 @@ func Test_Python_New(t *testing.T) { expectedPython: &Python{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { p := New() - require.Equal(t, tt.expectedPython, p) + require.Equal(t, tc.expectedPython, p) }) } } @@ -59,10 +59,10 @@ func Test_Python_IgnoreDirectories(t *testing.T) { expectedIgnoreDirectories: []string{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { p := New() - require.Equal(t, tt.expectedIgnoreDirectories, p.IgnoreDirectories()) + require.Equal(t, tc.expectedIgnoreDirectories, p.IgnoreDirectories()) }) } } @@ -167,8 +167,8 @@ func Test_Python_InstallProjectDependencies(t *testing.T) { expectedOutputs: "Manually setup a Python virtual environment", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) fs := slackdeps.NewFsMock() @@ -183,7 +183,7 @@ func Test_Python_InstallProjectDependencies(t *testing.T) { projectDirPath := "/path/to/project-name" // Create files - for filePath, fileData := range tt.existingFiles { + for filePath, fileData := range tc.existingFiles { filePathAbs := filepath.Join(projectDirPath, filePath) // Create the directory if err := fs.MkdirAll(filepath.Dir(filePathAbs), 0755); err != nil { @@ -200,16 +200,16 @@ func Test_Python_InstallProjectDependencies(t *testing.T) { outputs, err := p.InstallProjectDependencies(ctx, projectDirPath, mockHookExecutor, ios, fs, os) // Assertions - for filePath, fileData := range tt.expectedFiles { + for filePath, fileData := range tc.expectedFiles { filePathAbs := filepath.Join(projectDirPath, filePath) d, err := afero.ReadFile(fs, filePathAbs) require.NoError(t, err) require.Equal(t, fileData, string(d)) } - require.Contains(t, outputs, tt.expectedOutputs) + require.Contains(t, outputs, tc.expectedOutputs) - if tt.expectedError { + if tc.expectedError { require.Error(t, err) } else { require.NoError(t, err) @@ -233,10 +233,10 @@ func Test_Python_Version(t *testing.T) { expectedVersion: "python", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { p := New() - require.Equal(t, tt.expectedVersion, p.Version()) + require.Equal(t, tc.expectedVersion, p.Version()) }) } } @@ -265,16 +265,16 @@ func Test_Python_HooksJSONTemplate(t *testing.T) { expectedErrorType: &json.SyntaxError{}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup var anyJSON map[string]interface{} // Test - err := json.Unmarshal(tt.hooksJSONTemplate, &anyJSON) + err := json.Unmarshal(tc.hooksJSONTemplate, &anyJSON) // Assertions - require.IsType(t, tt.expectedErrorType, err) + require.IsType(t, tc.expectedErrorType, err) }) } } @@ -291,8 +291,8 @@ func Test_Python_PreparePackage(t *testing.T) { expectedPreparePackageError: nil, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { ctx := slackcontext.MockContext(t.Context()) // Setup SDKConfig @@ -304,7 +304,7 @@ func Test_Python_PreparePackage(t *testing.T) { // Setup HookExecutor mockHookExecutor := &hooks.MockHookExecutor{} - mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tt.hookExecutorError) + mockHookExecutor.On("Execute", mock.Anything, mock.Anything).Return("text output", tc.hookExecutorError) // Setup mockOpts := types.PreparePackageOpts{} @@ -317,7 +317,7 @@ func Test_Python_PreparePackage(t *testing.T) { err := p.PreparePackage(ctx, mockSDKConfig, mockHookExecutor, mockOpts) // Assertions - require.Equal(t, tt.expectedPreparePackageError, err) + require.Equal(t, tc.expectedPreparePackageError, err) }) } } @@ -348,15 +348,15 @@ func Test_Python_IsRuntimeForProject(t *testing.T) { expectedBool: true, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) fs := slackdeps.NewFsMock() projectDirPath := "/path/to/project-name" // Create files - for _, filePath := range tt.existingFilePaths { + for _, filePath := range tc.existingFilePaths { filePathAbs := filepath.Join(projectDirPath, filePath) // Create the directory if err := fs.MkdirAll(filepath.Dir(filePathAbs), 0755); err != nil { @@ -369,10 +369,10 @@ func Test_Python_IsRuntimeForProject(t *testing.T) { } // Test - b := IsRuntimeForProject(ctx, fs, projectDirPath, hooks.SDKCLIConfig{Runtime: tt.sdkConfigRuntime}) + b := IsRuntimeForProject(ctx, fs, projectDirPath, hooks.SDKCLIConfig{Runtime: tc.sdkConfigRuntime}) // Assertions - require.Equal(t, tt.expectedBool, b) + require.Equal(t, tc.expectedBool, b) }) } } diff --git a/internal/runtime/runtime_test.go b/internal/runtime/runtime_test.go index 85c3b7ee..53263a7a 100644 --- a/internal/runtime/runtime_test.go +++ b/internal/runtime/runtime_test.go @@ -53,11 +53,11 @@ func Test_Runtime_New(t *testing.T) { expectedRuntimeType: nil, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Run the test - rt, _ := New(tt.runtime) - require.IsType(t, tt.expectedRuntimeType, rt) + rt, _ := New(tc.runtime) + require.IsType(t, tc.expectedRuntimeType, rt) }) } } @@ -89,16 +89,16 @@ func Test_Runtime_NewDetectProject(t *testing.T) { expectedRuntimeType: nil, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { // Setup ctx := slackcontext.MockContext(t.Context()) fs := afero.NewMemMapFs() projectDirPath := "/path/to/project-name" // Run the test - rt, _ := NewDetectProject(ctx, fs, projectDirPath, tt.sdkConfig) - require.IsType(t, tt.expectedRuntimeType, rt) + rt, _ := NewDetectProject(ctx, fs, projectDirPath, tc.sdkConfig) + require.IsType(t, tc.expectedRuntimeType, rt) }) } } diff --git a/internal/shared/types/app_manifest_test.go b/internal/shared/types/app_manifest_test.go index c68d5572..a6cd7d5a 100644 --- a/internal/shared/types/app_manifest_test.go +++ b/internal/shared/types/app_manifest_test.go @@ -39,13 +39,13 @@ func Test_RawJSON_UnmarshalJSON(t *testing.T) { expectedJSONData: `{ "name": "foo" }`, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { rawJSON := &RawJSON{} - err := rawJSON.UnmarshalJSON([]byte(tt.blob)) + err := rawJSON.UnmarshalJSON([]byte(tc.blob)) - require.IsType(t, err, tt.expectedErrorType) - require.Equal(t, tt.expectedJSONData, string(*rawJSON.JSONData)) + require.IsType(t, err, tc.expectedErrorType) + require.Equal(t, tc.expectedJSONData, string(*rawJSON.JSONData)) }) } } diff --git a/internal/shared/types/auth_test.go b/internal/shared/types/auth_test.go index 0182b87e..b8c199a1 100644 --- a/internal/shared/types/auth_test.go +++ b/internal/shared/types/auth_test.go @@ -38,9 +38,9 @@ func Test_SlackAuth_AuthLevel(t *testing.T) { expectedAuthLevel: AuthLevelEnterprise, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.auth.AuthLevel(), tt.expectedAuthLevel) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.auth.AuthLevel(), tc.expectedAuthLevel) }) } } @@ -86,9 +86,9 @@ func Test_SlackAuth_ShouldRotateToken(t *testing.T) { expected: true, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expected, tt.input.ShouldRotateToken()) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.expected, tc.input.ShouldRotateToken()) }) } } @@ -123,9 +123,9 @@ func Test_SlackAuth_TokenIsExpired(t *testing.T) { expected: false, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.expected, tt.input.TokenIsExpired()) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.expected, tc.input.TokenIsExpired()) }) } } diff --git a/internal/shared/types/channel_test.go b/internal/shared/types/channel_test.go index 13d2f45b..dc9c35ad 100644 --- a/internal/shared/types/channel_test.go +++ b/internal/shared/types/channel_test.go @@ -49,9 +49,9 @@ func Test_SlackChannel_String(t *testing.T) { expectedString: "", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - require.Equal(t, tt.channel.String(), tt.expectedString) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.channel.String(), tc.expectedString) }) } } diff --git a/internal/shared/types/icon_test.go b/internal/shared/types/icon_test.go index 8c0ccb6b..eb45ccc4 100644 --- a/internal/shared/types/icon_test.go +++ b/internal/shared/types/icon_test.go @@ -52,12 +52,12 @@ func Test_Icons_MarshalJSON(t *testing.T) { }, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedBlob, err := json.Marshal(tt.icons) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedBlob, err := json.Marshal(tc.icons) - require.IsType(t, err, tt.expectedErrorType) - for _, expectedBlob := range tt.expectedBlobs { + require.IsType(t, err, tc.expectedErrorType) + for _, expectedBlob := range tc.expectedBlobs { require.Contains(t, string(returnedBlob), expectedBlob) } }) @@ -122,12 +122,12 @@ func Test_Icons_UnmarshalJSON(t *testing.T) { expectedIcons: &Icons{"image_96": "path/to/image_96.png", "image_192": "path/to/image_192.png"}, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := json.Unmarshal([]byte(tt.blob), &tt.icons) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + err := json.Unmarshal([]byte(tc.blob), &tc.icons) - require.IsType(t, err, tt.expectedErrorType) - require.Equal(t, tt.expectedIcons, tt.icons) + require.IsType(t, err, tc.expectedErrorType) + require.Equal(t, tc.expectedIcons, tc.icons) }) } } diff --git a/internal/shared/types/permissions_test.go b/internal/shared/types/permissions_test.go index 106043b1..f2e780dc 100644 --- a/internal/shared/types/permissions_test.go +++ b/internal/shared/types/permissions_test.go @@ -48,12 +48,12 @@ func Test_Permissions_StringToAppCollaboratorPermission(t *testing.T) { expectedAppCollaboratorPermission: "", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - appCollaboratorPermission, err := StringToAppCollaboratorPermission(tt.input) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + appCollaboratorPermission, err := StringToAppCollaboratorPermission(tc.input) - require.IsType(t, err, tt.expectedErrorType) - require.Equal(t, tt.expectedAppCollaboratorPermission, appCollaboratorPermission) + require.IsType(t, err, tc.expectedErrorType) + require.Equal(t, tc.expectedAppCollaboratorPermission, appCollaboratorPermission) }) } } @@ -80,11 +80,11 @@ func Test_Permissions_AppCollaboratorPermissionF(t *testing.T) { expectedString: "a collaborator", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedString := tt.acp.AppCollaboratorPermissionF() + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedString := tc.acp.AppCollaboratorPermissionF() - require.Equal(t, tt.expectedString, returnedString) + require.Equal(t, tc.expectedString, returnedString) }) } } @@ -126,11 +126,11 @@ func Test_Permission_IsValid(t *testing.T) { expectedIsValid: false, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedIsValid := tt.permission.IsValid() + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedIsValid := tc.permission.IsValid() - require.Equal(t, tt.expectedIsValid, returnedIsValid) + require.Equal(t, tc.expectedIsValid, returnedIsValid) }) } } @@ -162,11 +162,11 @@ func Test_Permission_ToString(t *testing.T) { expectedString: "", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedString := tt.permission.ToString() + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedString := tc.permission.ToString() - require.Equal(t, tt.expectedString, returnedString) + require.Equal(t, tc.expectedString, returnedString) }) } } @@ -237,7 +237,7 @@ func Test_Permissions_IsNamedEntityFlag(t *testing.T) { expectedIsNamedEntityFlag: false, }, } - for _, tt := range tests { + for _, tc := range tests { flags := pflag.NewFlagSet("entities", pflag.ContinueOnError) // Define the flags @@ -249,16 +249,16 @@ func Test_Permissions_IsNamedEntityFlag(t *testing.T) { // Set the flags based on the test values everyoneFlag := "" - if tt.flags.everyoneValue { + if tc.flags.everyoneValue { everyoneFlag = "--everyone" } args := []string{ everyoneFlag, - fmt.Sprintf("--channels=%s", tt.flags.channelsValue), - fmt.Sprintf("--organizations=%s", tt.flags.organizationsValue), - fmt.Sprintf("--users=%s", tt.flags.usersValue), - fmt.Sprintf("--workspaces=%s", tt.flags.workspacesValue), + fmt.Sprintf("--channels=%s", tc.flags.channelsValue), + fmt.Sprintf("--organizations=%s", tc.flags.organizationsValue), + fmt.Sprintf("--users=%s", tc.flags.usersValue), + fmt.Sprintf("--workspaces=%s", tc.flags.workspacesValue), } // Parse the flagset @@ -266,9 +266,9 @@ func Test_Permissions_IsNamedEntityFlag(t *testing.T) { require.Fail(t, err.Error(), "Flags parse error") } - t.Run(tt.name, func(t *testing.T) { + t.Run(tc.name, func(t *testing.T) { returnedIsNamedEntityFlag := IsNamedEntityFlag(flags) - require.Equal(t, tt.expectedIsNamedEntityFlag, returnedIsNamedEntityFlag) + require.Equal(t, tc.expectedIsNamedEntityFlag, returnedIsNamedEntityFlag) }) } } @@ -297,10 +297,10 @@ func Test_Permissions_GetAccessTypeDescriptionForEveryone(t *testing.T) { expectedString: "everyone in the workspace", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedString := GetAccessTypeDescriptionForEveryone(tt.app) - require.Equal(t, tt.expectedString, returnedString) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedString := GetAccessTypeDescriptionForEveryone(tc.app) + require.Equal(t, tc.expectedString, returnedString) }) } } diff --git a/internal/shared/types/team_test.go b/internal/shared/types/team_test.go index a34ac9e6..f23fcf56 100644 --- a/internal/shared/types/team_test.go +++ b/internal/shared/types/team_test.go @@ -47,10 +47,10 @@ func Test_SlackTeam_String(t *testing.T) { expectedString: "", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedString := tt.slackTeam.String() - require.Equal(t, tt.expectedString, returnedString) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedString := tc.slackTeam.String() + require.Equal(t, tc.expectedString, returnedString) }) } } diff --git a/internal/shared/types/triggers_test.go b/internal/shared/types/triggers_test.go index 041bf253..501a21cd 100644 --- a/internal/shared/types/triggers_test.go +++ b/internal/shared/types/triggers_test.go @@ -62,10 +62,10 @@ func Test_Triggers_IsKnownType(t *testing.T) { expectedBool: false, }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedBool := tt.trigger.IsKnownType() - require.Equal(t, tt.expectedBool, returnedBool) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedBool := tc.trigger.IsKnownType() + require.Equal(t, tc.expectedBool, returnedBool) }) } } diff --git a/internal/shared/types/user_test.go b/internal/shared/types/user_test.go index 4335dba6..dbe5a720 100644 --- a/internal/shared/types/user_test.go +++ b/internal/shared/types/user_test.go @@ -57,10 +57,10 @@ func Test_SlackUser_String(t *testing.T) { expectedString: " (U1234, owner)", // TODO - confirm that this is the result we want }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedString := tt.slackUser.String() - require.Equal(t, tt.expectedString, returnedString) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedString := tc.slackUser.String() + require.Equal(t, tc.expectedString, returnedString) }) } } @@ -92,10 +92,10 @@ func Test_SlackUser_ShorthandF(t *testing.T) { expectedString: "", }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - returnedString := tt.slackUser.ShorthandF() - require.Equal(t, tt.expectedString, returnedString) + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + returnedString := tc.slackUser.ShorthandF() + require.Equal(t, tc.expectedString, returnedString) }) } }