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