Angular deprecation: Disable dynamic angular inspector if CheckForPluginUpdates is false (#91194)

* Angular deprecation: Disable dynamic angular inspector if CheckForPluginUpdates is false

* Add tests

* add type checks for dynamic service
This commit is contained in:
Giuseppe Guerra
2024-07-31 10:10:12 +02:00
committed by GitHub
parent 160fe2a3a4
commit 95f340738c
2 changed files with 35 additions and 0 deletions

View File

@ -421,6 +421,24 @@ func TestDynamicAngularDetectorsProviderBackgroundService(t *testing.T) {
require.True(t, jobCalls.calledX(tcRuns), "should have the correct number of job calls")
require.True(t, gcom.httpCalls.calledX(tcRuns), "should have the correct number of gcom api calls")
})
t.Run("IsDisabled", func(t *testing.T) {
for _, tc := range []struct {
name string
checkForPluginUpdates bool
expIsDisabled bool
}{
{name: "true", checkForPluginUpdates: true, expIsDisabled: false},
{name: "false", checkForPluginUpdates: false, expIsDisabled: true},
} {
t.Run(tc.name, func(t *testing.T) {
cfg := setting.NewCfg()
cfg.CheckForPluginUpdates = tc.checkForPluginUpdates
svc := provideDynamic(t, srv.URL, provideDynamicOpts{cfg: cfg})
require.Equal(t, tc.expIsDisabled, svc.IsDisabled(), "IsDisabled should return correct value")
})
}
})
})
}