webpack/test/identifier.unittest.js

24 lines
674 B
JavaScript
Raw Normal View History

/* globals describe, beforeEach, it */
"use strict";
2017-04-06 19:33:57 +08:00
const identifierUtil = require("../lib/util/identifier");
2017-04-06 19:33:57 +08:00
describe("util/identifier", () => {
describe("makePathsRelative", () => {
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";
});
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
);
});
});
});
});