migrate catalog backend to msw2
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -107,7 +107,7 @@
|
||||
"@types/supertest": "^2.0.8",
|
||||
"better-sqlite3": "^12.0.0",
|
||||
"luxon": "^3.0.0",
|
||||
"msw": "^1.0.0",
|
||||
"msw": "^2.0.0",
|
||||
"supertest": "^7.0.0",
|
||||
"wait-for-expect": "^3.0.2",
|
||||
"winston": "^3.13.0"
|
||||
|
||||
@@ -18,8 +18,8 @@ import {
|
||||
mockServices,
|
||||
registerMswTestHooks,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { HttpResponse, http } from 'msw';
|
||||
import {
|
||||
CatalogProcessorCache,
|
||||
CatalogProcessorEntityResult,
|
||||
@@ -61,13 +61,15 @@ describe('UrlReaderProcessor', () => {
|
||||
};
|
||||
|
||||
server.use(
|
||||
rest.get(`${mockApiOrigin}/component.yaml`, (_, res, ctx) =>
|
||||
res(
|
||||
ctx.set({ ETag: 'my-etag' }),
|
||||
ctx.json({
|
||||
http.get(`${mockApiOrigin}/component.yaml`, () =>
|
||||
HttpResponse.json(
|
||||
{
|
||||
kind: 'component',
|
||||
metadata: { name: 'mock-url-entity' },
|
||||
}),
|
||||
},
|
||||
{
|
||||
headers: { ETag: 'my-etag' },
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -115,8 +117,8 @@ describe('UrlReaderProcessor', () => {
|
||||
}),
|
||||
});
|
||||
server.use(
|
||||
rest.get(`${mockApiOrigin}/component.yaml`, (_, res, ctx) =>
|
||||
res(ctx.status(304)),
|
||||
http.get(`${mockApiOrigin}/component.yaml`, () =>
|
||||
HttpResponse.json(null, { status: 304 }),
|
||||
),
|
||||
);
|
||||
const spec = {
|
||||
@@ -171,8 +173,8 @@ describe('UrlReaderProcessor', () => {
|
||||
};
|
||||
|
||||
server.use(
|
||||
rest.get(`${mockApiOrigin}/component-notfound.yaml`, (_, res, ctx) => {
|
||||
return res(ctx.status(404));
|
||||
http.get(`${mockApiOrigin}/component-notfound.yaml`, () => {
|
||||
return HttpResponse.json(null, { status: 404 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user