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