2023-01-11 12:52:20 +01:00
|
|
|
import { rest } from 'msw';
|
|
|
|
|
import { setupServer } from 'msw/node';
|
|
|
|
|
|
|
|
|
|
// bit of setup to mock HTTP request responses
|
|
|
|
|
import 'whatwg-fetch';
|
2023-01-13 13:34:39 +01:00
|
|
|
import { SupportedPlugin } from '../types/pluginBridges';
|
2023-01-11 12:52:20 +01:00
|
|
|
|
|
|
|
|
export const NON_EXISTING_PLUGIN = '__does_not_exist__';
|
|
|
|
|
|
|
|
|
|
const server = setupServer(
|
|
|
|
|
rest.get(`/api/plugins/${NON_EXISTING_PLUGIN}/settings`, async (_req, res, ctx) => res(ctx.status(404))),
|
|
|
|
|
rest.get(`/api/plugins/${SupportedPlugin.Incident}/settings`, async (_req, res, ctx) => {
|
|
|
|
|
return res(
|
|
|
|
|
ctx.json({
|
|
|
|
|
enabled: true,
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export { server };
|