2020-02-05 00:16:45 +00:00
|
|
|
import { normalize } from "../src/common/util"
|
2020-02-04 19:27:46 +00:00
|
|
|
|
|
|
|
describe("util", () => {
|
|
|
|
describe("normalize", () => {
|
|
|
|
it("should remove multiple slashes", () => {
|
2021-01-08 20:55:47 +00:00
|
|
|
expect(normalize("//foo//bar//baz///mumble")).toBe("/foo/bar/baz/mumble")
|
2020-02-04 19:27:46 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
it("should remove trailing slashes", () => {
|
2021-01-08 20:55:47 +00:00
|
|
|
expect(normalize("qux///")).toBe("qux")
|
2020-02-04 19:27:46 +00:00
|
|
|
})
|
2020-02-05 00:16:45 +00:00
|
|
|
|
|
|
|
it("should preserve trailing slash if it exists", () => {
|
2021-01-08 20:55:47 +00:00
|
|
|
expect(normalize("qux///", true)).toBe("qux/")
|
|
|
|
expect(normalize("qux", true)).toBe("qux")
|
2020-02-05 00:16:45 +00:00
|
|
|
})
|
2020-02-04 19:27:46 +00:00
|
|
|
})
|
|
|
|
})
|