1515package doctor
1616
1717import (
18- "context"
1918 "fmt"
2019 "runtime"
2120 "testing"
@@ -26,6 +25,7 @@ import (
2625 "github.com/slackapi/slack-cli/internal/pkg/version"
2726 "github.com/slackapi/slack-cli/internal/shared"
2827 "github.com/slackapi/slack-cli/internal/shared/types"
28+ "github.com/slackapi/slack-cli/internal/slackcontext"
2929 "github.com/slackapi/slack-cli/internal/slackerror"
3030 "github.com/stretchr/testify/assert"
3131 "github.com/stretchr/testify/mock"
@@ -34,10 +34,10 @@ import (
3434
3535func TestDoctorCheckOS (t * testing.T ) {
3636 t .Run ("returns the operating system version" , func (t * testing.T ) {
37+ ctx := slackcontext .MockContext (t .Context ())
3738 clientsMock := shared .NewClientsMock ()
3839 clientsMock .AddDefaultMocks ()
3940 clients := shared .NewClientFactory (clientsMock .MockClientFactory ())
40- ctx := context .Background ()
4141 expected := Section {
4242 Label : "Operating System" ,
4343 Value : "the computer conductor" ,
@@ -56,10 +56,10 @@ func TestDoctorCheckOS(t *testing.T) {
5656
5757func TestDoctorCheckCLIVersion (t * testing.T ) {
5858 t .Run ("returns the current version of this tool" , func (t * testing.T ) {
59+ ctx := slackcontext .MockContext (t .Context ())
5960 clientsMock := shared .NewClientsMock ()
6061 clientsMock .AddDefaultMocks ()
6162 clients := shared .NewClientFactory (clientsMock .MockClientFactory ())
62- ctx := context .Background ()
6363 expected := Section {
6464 Label : "CLI" ,
6565 Value : "this tool for building Slack apps" ,
@@ -141,13 +141,13 @@ func TestDoctorCheckProjectConfig(t *testing.T) {
141141
142142 for name , tt := range tests {
143143 t .Run (name , func (t * testing.T ) {
144+ ctx := slackcontext .MockContext (t .Context ())
144145 clientsMock := shared .NewClientsMock ()
145146 clientsMock .AddDefaultMocks ()
146147 pcm := & config.ProjectConfigMock {}
147148 pcm .On ("ReadProjectConfigFile" , mock .Anything ).Return (tt .projectConfig , nil )
148149 clientsMock .Config .ProjectConfig = pcm
149150 clients := shared .NewClientFactory (clientsMock .MockClientFactory ())
150- ctx := context .Background ()
151151 expected := Section {
152152 Label : "Configurations" ,
153153 Value : "your project's CLI settings" ,
@@ -218,10 +218,10 @@ func TestDoctorCheckProjectDeps(t *testing.T) {
218218
219219 for name , tt := range tests {
220220 t .Run (name , func (t * testing.T ) {
221+ ctx := slackcontext .MockContext (t .Context ())
221222 clientsMock := shared .NewClientsMock ()
222223 clientsMock .AddDefaultMocks ()
223224 clients := tt .mockHookSetup (clientsMock )
224- ctx := context .Background ()
225225 expected := Section {
226226 Label : "Dependencies" ,
227227 Value : "requisites for development" ,
@@ -246,6 +246,7 @@ func TestDoctorCheckCLIConfig(t *testing.T) {
246246
247247 for name , tt := range tests {
248248 t .Run (name , func (t * testing.T ) {
249+ ctx := slackcontext .MockContext (t .Context ())
249250 clientsMock := shared .NewClientsMock ()
250251 clientsMock .AddDefaultMocks ()
251252 scm := & config.SystemConfigMock {}
@@ -254,7 +255,6 @@ func TestDoctorCheckCLIConfig(t *testing.T) {
254255 }, nil )
255256 clientsMock .Config .SystemConfig = scm
256257 clients := shared .NewClientFactory (clientsMock .MockClientFactory ())
257- ctx := context .Background ()
258258 expected := Section {
259259 Label : "Configurations" ,
260260 Value : "any adjustments to settings" ,
@@ -297,10 +297,10 @@ func TestDoctorCheckCLICreds(t *testing.T) {
297297
298298 for name := range tests {
299299 t .Run (name , func (t * testing.T ) {
300+ ctx := slackcontext .MockContext (t .Context ())
300301 clientsMock := shared .NewClientsMock ()
301302 clientsMock .AddDefaultMocks ()
302303 clients := shared .NewClientFactory (clientsMock .MockClientFactory ())
303- ctx := context .Background ()
304304 expected := Section {
305305 Label : "Credentials" ,
306306 Value : "your Slack authentication" ,
@@ -391,10 +391,10 @@ func TestDoctorCheckProjectTooling(t *testing.T) {
391391
392392 for name , tt := range tests {
393393 t .Run (name , func (t * testing.T ) {
394+ ctx := slackcontext .MockContext (t .Context ())
394395 clientsMock := shared .NewClientsMock ()
395396 clientsMock .AddDefaultMocks ()
396397 clients := tt .mockHookSetup (clientsMock )
397- ctx := context .Background ()
398398 expected := Section {
399399 Label : "Runtime" ,
400400 Value : "foundations for the application" ,
@@ -410,7 +410,7 @@ func TestDoctorCheckProjectTooling(t *testing.T) {
410410
411411func TestDoctorCheckGit (t * testing.T ) {
412412 t .Run ("returns the version of git" , func (t * testing.T ) {
413- ctx := context . Background ( )
413+ ctx := slackcontext . MockContext ( t . Context () )
414414 gitVersion , err := deputil .GetGitVersion ()
415415 require .NoError (t , err )
416416 expected := Section {
0 commit comments