Source code
Revision control
Copy as Markdown
Other Tools
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
import { basename, dirname, isURL, isAbsolute, join } from "../path";
const absoluteTestPath = "/some/absolute/path/to/resource";
const aTestName = "name";
describe("basename()", () => {
it("returns the basename of the path", () => {
expect(basename(fullTestURL)).toBe("endpoint");
});
});
describe("dirname()", () => {
it("returns the current directory in a path", () => {
});
});
describe("isURL()", () => {
it("returns true if a string contains characters denoting a scheme", () => {
expect(isURL(fullTestURL)).toBe(true);
});
it("returns false if string does not denote a scheme", () => {
expect(isURL(absoluteTestPath)).toBe(false);
});
});
describe("isAbsolute()", () => {
it("returns true if a string begins with a slash", () => {
expect(isAbsolute(absoluteTestPath)).toBe(true);
});
it("returns false if a string does not begin with a slash", () => {
expect(isAbsolute(fullTestURL)).toBe(false);
});
});
describe("join()", () => {
it("concatenates a base path and a directory name", () => {
expect(join(absoluteTestPath, aTestName)).toBe(
"/some/absolute/path/to/resource/name"
);
});
});