migrate catalog backend to msw2

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2025-08-14 17:30:14 +02:00
parent bb5f5145e6
commit adef009079
3 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -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 });
}),
);
+1 -1
View File
@@ -4719,7 +4719,7 @@ __metadata:
lodash: "npm:^4.17.21"
luxon: "npm:^3.0.0"
minimatch: "npm:^9.0.0"
msw: "npm:^1.0.0"
msw: "npm:^2.0.0"
p-limit: "npm:^3.0.2"
prom-client: "npm:^15.0.0"
supertest: "npm:^7.0.0"