Skip to content

Commit bd89d2d

Browse files
committed
fixup! Refactor files.spec.js for possible basePath.
1 parent 34a94d5 commit bd89d2d

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/unit/middleware/files.spec.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ basePathConfigs.forEach(([basePath, testTitle]) => {
291291
await request(app)
292292
.get(basePath + "/foo")
293293
.expect((res) => {
294-
expect(res.headers.location).to.equal("/foo/");
294+
expect(res.headers.location).to.equal(basePath + "/foo/");
295295
})
296296
.expect(301);
297297
});
@@ -302,7 +302,9 @@ basePathConfigs.forEach(([basePath, testTitle]) => {
302302
await request(app)
303303
.get(basePath + "/foo?query=params")
304304
.expect((req) => {
305-
expect(req.headers.location).to.equal("/foo/?query=params");
305+
expect(req.headers.location).to.equal(
306+
basePath + "/foo/?query=params"
307+
);
306308
})
307309
.expect(301);
308310
});
@@ -314,7 +316,7 @@ basePathConfigs.forEach(([basePath, testTitle]) => {
314316
await request(app)
315317
.get(basePath + "/foo")
316318
.expect(301)
317-
.expect("Location", "/foo/");
319+
.expect("Location", basePath + "/foo/");
318320
});
319321
});
320322

@@ -325,7 +327,7 @@ basePathConfigs.forEach(([basePath, testTitle]) => {
325327
await request(app)
326328
.get(basePath + "/foo/")
327329
.expect(301)
328-
.expect("Location", "/foo");
330+
.expect("Location", basePath + "/foo");
329331
});
330332

331333
it("returns a 404 if a trailing slash was added to a valid path", async () => {
@@ -342,7 +344,7 @@ basePathConfigs.forEach(([basePath, testTitle]) => {
342344
await request(app)
343345
.get(basePath + "/foo/")
344346
.expect(301)
345-
.expect("Location", "/foo");
347+
.expect("Location", basePath + "/foo");
346348
});
347349

348350
it("normalizes multiple leading slashes on a redirect", async () => {
@@ -351,7 +353,7 @@ basePathConfigs.forEach(([basePath, testTitle]) => {
351353
await request(app)
352354
.get(basePath + "/foo////")
353355
.expect(301)
354-
.expect("Location", "/foo");
356+
.expect("Location", basePath + "/foo");
355357
});
356358
});
357359

0 commit comments

Comments
 (0)