2017-04-05 21:38:15 +08:00
|
|
|
/* globals describe, beforeEach, it */
|
|
|
|
"use strict";
|
|
|
|
|
2017-04-06 19:33:57 +08:00
|
|
|
const identifierUtil = require("../lib/util/identifier");
|
2017-04-05 21:38:15 +08:00
|
|
|
|
2017-04-06 19:33:57 +08:00
|
|
|
describe("util/identifier", () => {
|
|
|
|
describe("makePathsRelative", () => {
|
2017-04-05 21:38:15 +08:00
|
|
|
describe("given a context and a pathConstruct", () => {
|
|
|
|
let context, pathConstruct, expected;
|
|
|
|
beforeEach(() => {
|
|
|
|
context = "/some/dir/";
|
2018-02-26 10:46:46 +08:00
|
|
|
pathConstruct = "/some/dir/to/somewhere|some/other/dir!../more/dir";
|
2018-12-08 03:16:39 +08:00
|
|
|
expected = "./to/somewhere|some/other/dir!../more/dir";
|
2017-04-05 21:38:15 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it("computes the correct relative results for the path construct", () => {
|
2018-02-25 18:46:17 +08:00
|
|
|
expect(identifierUtil.makePathsRelative(context, pathConstruct)).toBe(
|
|
|
|
expected
|
|
|
|
);
|
2017-04-05 21:38:15 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|