@@ -19,12 +19,14 @@ import (
1919
2020 "github.com/slackapi/slack-cli/internal/hooks"
2121 "github.com/slackapi/slack-cli/internal/shared"
22+ "github.com/slackapi/slack-cli/internal/slackcontext"
2223 "github.com/slackapi/slack-cli/test/testutil"
2324 "github.com/stretchr/testify/assert"
2425)
2526
2627func TestWorkspaceCommand (t * testing.T ) {
2728 // Create mocks
29+ ctx := slackcontext .MockContext (t .Context ())
2830 clientsMock := shared .NewClientsMock ()
2931
3032 // Create clients that is mocked for testing
@@ -40,42 +42,10 @@ func TestWorkspaceCommand(t *testing.T) {
4042 listFunc = listPkgMock .List
4143 listPkgMock .On ("List" ).Return (nil )
4244
43- err := cmd .Execute ( )
45+ err := cmd .ExecuteContext ( ctx )
4446 if err != nil {
4547 assert .Fail (t , "cmd.Execute had unexpected error" )
4648 }
4749
4850 listPkgMock .AssertCalled (t , "List" )
4951}
50-
51- // TODO: this test may need a stubbed out parent (root) command to get aliasing working
52- /*
53- func TestPostRunWorkspaceDeprecationMessage(t *testing.T) {
54-
55- // Create mocks
56- clientsMock := shared.NewClientsMock()
57- clientsMock.AddDefaultMocks()
58-
59- // Create clients that is mocked for testing
60- clients := shared.NewClientFactory(clientsMock.MockClientFactory(), func(clients *shared.ClientFactory) {
61- clients.SDKConfig = hooks.NewSDKConfigMock()
62- })
63- clients.IO = clientsMock.IO
64- cmd := NewCommand(clients)
65- // TODO: could maybe refactor this to the os/fs mocks level to more clearly communicate "fake being in an app directory"
66- cmd.PreRunE = func(cmd *cobra.Command, args []string) error { return nil }
67- args := []string{"team"}
68- cmd.SetArgs(args)
69-
70- testutil.MockCmdIO(clientsMock.IO, cmd)
71- listPkgMock := new(ListPkgMock)
72- listFunc = listPkgMock.List
73- listPkgMock.On("List").Return(nil)
74-
75- err := cmd.Execute()
76- if err != nil {
77- assert.Fail(t, "cmd.Execute had unexpected error", err.Error())
78- }
79- require.Contains(t, clientsMock.GetStdoutOutput(), "You can now use")
80- }
81- */
0 commit comments