Skip to content

Commit 5b78e3c

Browse files
committed
feat(testing): add tests for constructRedirectPath
1 parent 427b65f commit 5b78e3c

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/unit/node/http.test.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { relativeRoot } from "../../../src/node/http"
1+
import { constructRedirectPath, relativeRoot } from "../../../src/node/http"
22

33
describe("http", () => {
44
it("should construct a relative path to the root", () => {
@@ -9,3 +9,18 @@ describe("http", () => {
99
expect(relativeRoot("/foo/bar/")).toStrictEqual("./../..")
1010
})
1111
})
12+
13+
describe("constructRedirectPath", () => {
14+
it("should preserve slashes in queryString so they are human-readable", () => {
15+
// TODO@jsjoeio - use this package
16+
// https://www.npmjs.com/package/@jest-mock/express
17+
const mockReq = {}
18+
// TODO@jsjoeio - I don't know how the query params should look here
19+
const mockQueryParams = {folder: "yes"}
20+
// TODO@jsjoeio - I think we're redirecting to the same path so could be "" maybe?
21+
const mockTo = "something"
22+
const actual = constructRedirectPath(mockReq, mockQueryParams, mockTo)
23+
const expected = "TODO"
24+
expect(actual).toBe(expected)
25+
})
26+
})

0 commit comments

Comments
 (0)