Skip to content

Commit c9fa4cd

Browse files
committed
fix: use TestInit deps struct in Test_GetCodeLensForPath [IDE-2036]
Global di.*() accessors return nil after the DI refactor (50cbbef) because TestInit no longer writes globals. Capture the returned Dependencies struct and use its fields directly.
1 parent 8cfca49 commit c9fa4cd

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,14 @@ brain/
103103
.verify-agent-progress
104104
.pr-review-*.md
105105
.verify-metrics-pending
106+
.verify-complete
107+
.verify-precommit-hash
108+
.verify-agents
109+
.verify-counts
110+
.verify-staged-hash
111+
*_????????_??????_*.log
112+
.snyk-sca-output.json
113+
.snyk-sca-output.err
114+
.snyk-code-output.json
115+
.snyk-code-output.err
116+
.verification-result.*

domain/ide/codelens/codelens_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,20 @@ func Test_GetCodeLensFromCommand(t *testing.T) {
4747

4848
func Test_GetCodeLensForPath(t *testing.T) {
4949
engine, tokenService := testutil.IntegTestWithEngine(t)
50-
di.TestInit(t, engine, tokenService, nil) // IntegTest doesn't automatically inits DI
50+
deps := di.TestInit(t, engine, tokenService, nil) // IntegTest doesn't automatically inits DI
5151
testutil.EnableSastAndAutoFix(engine)
5252
// this is using the real progress channel, so we need to listen to it
5353
dummyProgressListeners(t)
5454

5555
// Configure fake authentication to avoid real API calls
5656
engine.GetConfiguration().Set(configresolver.UserGlobalKey(types.SettingAuthenticationMethod), string(types.FakeAuthentication))
5757
tokenService.SetToken(engine.GetConfiguration(), "00000000-0000-0000-0000-000000000001")
58-
di.AuthenticationService().ConfigureProviders(engine.GetConfiguration(), engine.GetLogger())
59-
fakeAuthenticationProvider := di.AuthenticationService().Provider().(*authentication.FakeAuthenticationProvider)
58+
deps.AuthenticationService.ConfigureProviders(engine.GetConfiguration(), engine.GetLogger())
59+
fakeAuthenticationProvider := deps.AuthenticationService.Provider().(*authentication.FakeAuthenticationProvider)
6060
fakeAuthenticationProvider.IsAuthenticated = true
6161

6262
filePath, dir := code.TempWorkdirWithIssues(t)
63-
folder := workspace.NewFolder(engine.GetConfiguration(), engine.GetLogger(), dir, "dummy", di.Scanner(), di.HoverService(), di.ScanNotifier(), di.Notifier(), di.ScanPersister(), di.ScanStateAggregator(), di.FeatureFlagService(), di.ConfigResolver(), engine)
63+
folder := workspace.NewFolder(engine.GetConfiguration(), engine.GetLogger(), dir, "dummy", deps.Scanner, deps.HoverService, deps.ScanNotifier, deps.Notifier, deps.ScanPersister, deps.ScanStateAggregator, deps.FeatureFlagService, deps.ConfigResolver, engine)
6464
config.GetWorkspace(engine.GetConfiguration()).AddFolder(folder)
6565

6666
// as code is only enabled if sast settings are enabled, and sast settings are checked in folder config

0 commit comments

Comments
 (0)