Skip to content

Commit 1cd1246

Browse files
committed
test: add new test
1 parent 6930d5d commit 1cd1246

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

transforms/__testfixtures__/v4-deprecated-signatures/redirect.input.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ app.get("/", function (req, response) {
1111
response.redirect("/other-page", 301);
1212
});
1313

14+
app.get("/", function (req, res) {
15+
res.redirect(301, "/other-page");
16+
});
17+
18+
app.get("/", function (req, res) {
19+
res.redirect("/other-page");
20+
});
21+
1422
app.get("/", function (req, res) {
1523
redirect(301, "/other-page");
1624
});

transforms/__testfixtures__/v4-deprecated-signatures/redirect.output.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ app.get("/", function (req, response) {
1111
response.redirect(301, "/other-page");
1212
});
1313

14+
app.get("/", function (req, res) {
15+
res.redirect(301, "/other-page");
16+
});
17+
18+
app.get("/", function (req, res) {
19+
res.redirect("/other-page");
20+
});
21+
1422
app.get("/", function (req, res) {
1523
redirect(301, "/other-page");
1624
});

transforms/v4-deprecated-signatures.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ export default function transformer(file: FileInfo, _api: API): string {
124124
},
125125
})
126126
.map((path) => {
127-
const args = path.value.arguments;
127+
const args = path.value.arguments
128128

129129
// if its already in the correct order, dont reverse
130-
if (args.length === 2 && typeof args[0].type !== 'number') {
131-
args.reverse();
130+
if (args.length === 2 && args[0]?.type !== 'NumericLiteral') {
131+
args.reverse()
132132
}
133133

134134
return path

0 commit comments

Comments
 (0)