mirror of https://github.com/grafana/grafana
chore: use IRM plugin ID instead of OnCall / Incident if it's present… (#99742)
* chore: use IRM plugin ID instead of OnCall / Incident if it's present in the stack * minor improvements * fix unit tests * Add IRM plugin discovery tests --------- Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com>pull/99823/head
parent
b683724bec
commit
3589d9192d
@ -0,0 +1,27 @@ |
||||
import { config } from '@grafana/runtime'; |
||||
|
||||
import { pluginMeta, pluginMetaToPluginConfig } from '../testSetup/plugins'; |
||||
import { SupportedPlugin } from '../types/pluginBridges'; |
||||
|
||||
import { getProxyApiUrl } from './onCallApi'; |
||||
|
||||
describe('getProxyApiUrl', () => { |
||||
it('should return URL with IRM plugin ID when IRM plugin is present', () => { |
||||
config.apps = { [SupportedPlugin.Irm]: pluginMetaToPluginConfig(pluginMeta[SupportedPlugin.Irm]) }; |
||||
|
||||
expect(getProxyApiUrl('/alert_receive_channels/')).toBe( |
||||
'/api/plugins/grafana-irm-app/resources/alert_receive_channels/' |
||||
); |
||||
}); |
||||
|
||||
it('should return URL with OnCall plugin ID when IRM plugin is not present', () => { |
||||
config.apps = { |
||||
[SupportedPlugin.OnCall]: pluginMetaToPluginConfig(pluginMeta[SupportedPlugin.OnCall]), |
||||
[SupportedPlugin.Incident]: pluginMetaToPluginConfig(pluginMeta[SupportedPlugin.Incident]), |
||||
}; |
||||
|
||||
expect(getProxyApiUrl('/alert_receive_channels/')).toBe( |
||||
'/api/plugins/grafana-oncall-app/resources/alert_receive_channels/' |
||||
); |
||||
}); |
||||
}); |
After Width: | Height: | Size: 4.2 KiB |
Loading…
Reference in new issue