Files
grafana/public/app/features/alerting/unified/components/PluginBridge.mock.ts
Ashley Harrison cf65d91ee9 Chore: upgrade to msw v2 (#82270)
* Update dependency msw to v2

* close

* minor fixes

* fetch import changes

* fix some alerting tests

* fix another alerting test

* fix systemjs tests

* don't return undefined in json mocks

* don't return undefined in json response

* add type

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-14 13:16:44 +00:00

27 lines
616 B
TypeScript

// bit of setup to mock HTTP request responses
import 'whatwg-fetch';
import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node';
import { SupportedPlugin } from '../types/pluginBridges';
export const NON_EXISTING_PLUGIN = '__does_not_exist__';
const server = setupServer(
http.get(`/api/plugins/${NON_EXISTING_PLUGIN}/settings`, async () =>
HttpResponse.json(
{},
{
status: 404,
}
)
),
http.get(`/api/plugins/${SupportedPlugin.Incident}/settings`, async () => {
return HttpResponse.json({
enabled: true,
});
})
);
export { server };