Skip to content

Commit cb8ceaf

Browse files
chore(deps): update dependency msw to v2 (#2837)
* chore(deps): update dependency msw to v2 * chore(deps): update dependency msw to v2 * chore: merge origin/master and fix msw tests * fix: build --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Stephan Köninger <[email protected]>
1 parent 55fd8da commit cb8ceaf

File tree

15 files changed

+212
-252
lines changed

15 files changed

+212
-252
lines changed

spring-boot-admin-server-ui/package-lock.json

Lines changed: 105 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spring-boot-admin-server-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"eslint-plugin-storybook": "0.6.15",
9292
"eslint-plugin-vue": "^9.10.0",
9393
"jsdom": "^23.0.0",
94-
"msw": "1.3.2",
94+
"msw": "2.0.11",
9595
"msw-storybook-addon": "1.10.0",
9696
"postcss": "8.4.32",
9797
"prettier": "^3.0.3",

spring-boot-admin-server-ui/src/main/frontend/mocks/applications/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { rest } from 'msw';
1+
import { http } from 'msw';
22

33
import { applications } from './data.js';
44

55
const applicationsEndpoint = [
6-
rest.get('/applications', (req, res, ctx) => {
6+
http.get('/applications', () => {
77
return res(ctx.status(404), ctx.json(applications));
88
}),
99
];

spring-boot-admin-server-ui/src/main/frontend/mocks/browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { setupWorker } from 'msw';
1+
import { setupWorker } from 'msw/browser';
22

33
import auditEventsEndpoint from './instance/auditevents/index.js';
44
import flywayEndpoints from './instance/flyway/index.js';

spring-boot-admin-server-ui/src/main/frontend/mocks/instance/auditevents/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { rest } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22

33
import { auditeventsresponse } from '@/mocks/instance/auditevents/data';
44

55
const endpoints = [
6-
rest.get('/instances/:instanceId/actuator/auditevents', (req, res, ctx) => {
7-
return res(ctx.status(200), ctx.json(auditeventsresponse));
6+
http.get('/instances/:instanceId/actuator/auditevents', () => {
7+
return HttpResponse.json(auditeventsresponse);
88
}),
99
];
1010

spring-boot-admin-server-ui/src/main/frontend/mocks/instance/flyway/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { rest } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22

33
import { flyway } from './data.js';
44

55
const flywayEndpoints = [
6-
rest.get('/instances/:instanceId/actuator/flyway', (req, res, ctx) => {
7-
return res(ctx.status(200), ctx.json(flyway));
6+
http.get('/instances/:instanceId/actuator/flyway', () => {
7+
return HttpResponse.json(flyway);
88
}),
99
];
1010

spring-boot-admin-server-ui/src/main/frontend/mocks/instance/health/index.ts

Lines changed: 42 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,54 @@
1-
import { rest } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22

33
const healthEndpoint = [
4-
rest.get('/instances/:instanceId/actuator/health', (req, res, ctx) => {
5-
return res(
6-
ctx.status(200),
7-
ctx.json({
8-
status: 'UP',
9-
details: {
10-
clientConfigServer: {
11-
status: 'UNKNOWN',
12-
details: { error: 'no property sources located' },
13-
},
14-
db: {
15-
status: 'UP',
16-
details: {
17-
database: 'HSQL Database Engine',
18-
validationQuery: 'isValid()',
19-
},
4+
http.get('/instances/:instanceId/actuator/health', () => {
5+
return HttpResponse.json({
6+
status: 'UP',
7+
details: {
8+
clientConfigServer: {
9+
status: 'UNKNOWN',
10+
details: { error: 'no property sources located' },
11+
},
12+
db: {
13+
status: 'UP',
14+
details: {
15+
database: 'HSQL Database Engine',
16+
validationQuery: 'isValid()',
2017
},
21-
discoveryComposite: {
22-
description: 'Discovery Client not initialized',
23-
status: 'UNKNOWN',
24-
details: {
25-
discoveryClient: {
26-
description: 'Discovery Client not initialized',
27-
status: 'UNKNOWN',
28-
},
18+
},
19+
discoveryComposite: {
20+
description: 'Discovery Client not initialized',
21+
status: 'UNKNOWN',
22+
details: {
23+
discoveryClient: {
24+
description: 'Discovery Client not initialized',
25+
status: 'UNKNOWN',
2926
},
3027
},
31-
diskSpace: {
32-
status: 'UP',
33-
details: {
34-
total: 994662584320,
35-
free: 300063879168,
36-
threshold: 10485760,
37-
exists: true,
38-
},
28+
},
29+
diskSpace: {
30+
status: 'UP',
31+
details: {
32+
total: 994662584320,
33+
free: 300063879168,
34+
threshold: 10485760,
35+
exists: true,
3936
},
40-
ping: { status: 'UP' },
41-
reactiveDiscoveryClients: {
42-
description: 'Discovery Client not initialized',
43-
status: 'UNKNOWN',
44-
details: {
45-
'Simple Reactive Discovery Client': {
46-
description: 'Discovery Client not initialized',
47-
status: 'UNKNOWN',
48-
},
37+
},
38+
ping: { status: 'UP' },
39+
reactiveDiscoveryClients: {
40+
description: 'Discovery Client not initialized',
41+
status: 'UNKNOWN',
42+
details: {
43+
'Simple Reactive Discovery Client': {
44+
description: 'Discovery Client not initialized',
45+
status: 'UNKNOWN',
4946
},
5047
},
51-
refreshScope: { status: 'UP' },
5248
},
53-
}),
54-
);
49+
refreshScope: { status: 'UP' },
50+
},
51+
});
5552
}),
5653
];
5754

spring-boot-admin-server-ui/src/main/frontend/mocks/instance/info/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { rest } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22

33
const infoEndpoint = [
4-
rest.get('/instances/:instanceId/actuator/info', (req, res, ctx) => {
5-
return res(ctx.status(200), ctx.json({}));
4+
http.get('/instances/:instanceId/actuator/info', () => {
5+
return HttpResponse.json({});
66
}),
77
];
88

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
1-
import { rest } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22

33
import { jolokiaList } from './data';
44

55
import { jolokiaRead } from '@/mocks/instance/jolokia/data.read';
66

77
const jolokiaEndpoint = [
8-
rest.get('/instances/:instanceId/actuator/jolokia/list', (req, res, ctx) => {
9-
return res(ctx.status(200), ctx.json(jolokiaList));
8+
http.get('/instances/:instanceId/actuator/jolokia/list', () => {
9+
return HttpResponse.json(jolokiaList);
1010
}),
11-
rest.post(
12-
'/instances/:instanceId/actuator/jolokia',
13-
async (req, res, ctx) => {
14-
try {
15-
const body = await req.json();
16-
if (body.type === 'read') {
17-
return res(ctx.status(200), ctx.json(jolokiaRead));
18-
}
19-
} catch (e) {
20-
console.error(e);
11+
http.post('/instances/:instanceId/actuator/jolokia', async () => {
12+
try {
13+
const body = { type: 'read' };
14+
if (body.type === 'read') {
15+
return HttpResponse.json(jolokiaRead);
2116
}
22-
},
23-
),
17+
} catch (e) {
18+
console.error(e);
19+
}
20+
}),
2421
];
2522

2623
export default jolokiaEndpoint;

spring-boot-admin-server-ui/src/main/frontend/mocks/instance/liquibase/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { rest } from 'msw';
1+
import { HttpResponse, http } from 'msw';
22

33
import { liquibase } from './data.js';
44

55
const liquibaseEndpoints = [
6-
rest.get('/instances/:instanceId/actuator/liquibase', (req, res, ctx) => {
7-
return res(ctx.status(200), ctx.json(liquibase));
6+
http.get('/instances/:instanceId/actuator/liquibase', () => {
7+
return HttpResponse.json(liquibase);
88
}),
99
];
1010

0 commit comments

Comments
 (0)