Skip to content

Commit 536e0b0

Browse files
authored
test(express-5): change routes in tests to new path route syntax (#1036)
1 parent 2e02653 commit 536e0b0

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

test/1022.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ describe(packageJson.name, () => {
125125
.get(`/api/test/:id`, (req, res) =>
126126
res.status(200).json({ id: 'id-test', label: 'label' }),
127127
)
128-
.post(`/api/test/:id:clone`, (req, res) =>
128+
.post(`/api/test/:id\\:clone`, (req, res) =>
129129
res.status(200).json({ ...req.body, id: 'id-test' }),
130130
)
131-
.get('/api/some/:wildcard(*)', (req, res) => {
131+
.get('/api/some/:wildcard(*wildcardSuffix)', (req, res) => {
132132
const wildcard = req.params.wildcard;
133133
console.log(`Wildcard: ${wildcard}`);
134134
res.status(200).send(`Matched wildcard: ${wildcard}`);

test/699.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('699', () => {
5353
},
5454
3005,
5555
(app) => {
56-
app.get([`${app.basePath}/users/:id?`], (req, res) => {
56+
app.get([`${app.basePath}/users/{:id}`], (req, res) => {
5757
if (typeof req.params.id !== 'object') {
5858
throw new Error("Should be deserialized to ObjectId object");
5959
}
@@ -181,7 +181,7 @@ describe('699 serialize response components only', () => {
181181
},
182182
3005,
183183
(app) => {
184-
app.get([`${app.basePath}/users/:id?`], (req, res) => {
184+
app.get([`${app.basePath}/users/{:id}`], (req, res) => {
185185
if (typeof req.params.id !== 'string') {
186186
throw new Error("Should be not be deserialized to ObjectId object");
187187
}

test/multipart.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe('a multipart request', () => {
3333
metadata: req.body.metadata,
3434
});
3535
})
36-
.post(`/sample_*`, (req, res) => res.json(req.body)),
36+
.post(`/sample_*suffix`, (req, res) => res.json(req.body)),
3737
),
3838
);
3939
});

test/path.params.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ describe('path params', () => {
1818
3005,
1919
(app) => {
2020
app.get(
21-
[`${app.basePath}/users/:id?`, `${app.basePath}/users_alt/:id?`],
21+
[`${app.basePath}/users/{:id}`, `${app.basePath}/users_alt/{:id}`],
2222
(req, res) => {
2323
res.json({
2424
id: req.params.id,
@@ -30,7 +30,7 @@ describe('path params', () => {
3030
id: req.params.name,
3131
});
3232
});
33-
app.get(`${app.basePath}/multi_users/:ids?`, (req, res) => {
33+
app.get(`${app.basePath}/multi_users/{:ids}`, (req, res) => {
3434
res.json({
3535
ids: req.params.ids,
3636
});

test/serdes.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ describe('serdes', () => {
6262
},
6363
3005,
6464
(app) => {
65-
app.get([`${app.basePath}/users/:id?`], (req, res) => {
65+
app.get([`${app.basePath}/users/{:id}`], (req, res) => {
6666
if (typeof req.params.id !== 'object') {
6767
throw new Error("Should be deserialized to ObjectId object");
6868
}
@@ -237,7 +237,7 @@ describe('serdes serialize response components only', () => {
237237
},
238238
3005,
239239
(app) => {
240-
app.get([`${app.basePath}/users/:id?`], (req, res) => {
240+
app.get([`${app.basePath}/users/{:id}`], (req, res) => {
241241
if (typeof req.params.id !== 'string') {
242242
throw new Error("Should be not be deserialized to ObjectId object");
243243
}
@@ -431,7 +431,7 @@ describe('serdes with array type string-list', () => {
431431
},
432432
3005,
433433
(app) => {
434-
app.get([`${app.basePath}/users/:id?`], (req, res) => {
434+
app.get([`${app.basePath}/users/{:id}`], (req, res) => {
435435
if (typeof req.params.id !== 'object') {
436436
throw new Error("Should be deserialized to ObjectId object");
437437
}

0 commit comments

Comments
 (0)