Skip to content

Commit

Permalink
fix merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Feb 7, 2022
1 parent b76de52 commit 0c18298
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/ResolverFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ exports.createResolver = function (options) {
resolver.ensureHook("resolved");

// TODO remove in next major
// cspell:word Interal
// Backward-compat
resolver.hooks.newInteralResolve = resolver.hooks.newInternalResolve;

Expand Down
2 changes: 1 addition & 1 deletion lib/getPaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"use strict";

module.exports = function getPaths(path) {
if (path === "/") return { paths: ["/"], seqments: [""] };
if (path === "/") return { paths: ["/"], segments: [""] };
const parts = path.split(/(.*?[\\/]+)/);
const paths = [path];
const segments = [parts[parts.length - 1]];
Expand Down
16 changes: 8 additions & 8 deletions test/getPaths.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ require("should");
const getPaths = require("../lib/getPaths");

/**
* @type {[string,{paths: string[], seqments: string[]}][]}
* @type {[string,{paths: string[], segments: string[]}][]}
*/
const cases = [
["/a", { paths: ["/a", "/"], seqments: ["a", "/"] }],
["/a/", { paths: ["/a/", "/a", "/"], seqments: ["", "a", "/"] }],
["/a/b", { paths: ["/a/b", "/a", "/"], seqments: ["b", "a", "/"] }],
["/a", { paths: ["/a", "/"], segments: ["a", "/"] }],
["/a/", { paths: ["/a/", "/a", "/"], segments: ["", "a", "/"] }],
["/a/b", { paths: ["/a/b", "/a", "/"], segments: ["b", "a", "/"] }],
[
"/a/b/",
{ paths: ["/a/b/", "/a/b", "/a", "/"], seqments: ["", "b", "a", "/"] }
{ paths: ["/a/b/", "/a/b", "/a", "/"], segments: ["", "b", "a", "/"] }
],
["/", { paths: ["/"], seqments: [""] }]
["/", { paths: ["/"], segments: [""] }]
];

cases.forEach(case_ => {
it(case_[0], () => {
const { paths, seqments } = getPaths(case_[0]);
const { paths, segments } = getPaths(case_[0]);
paths.should.be.eql(case_[1].paths);
seqments.should.be.eql(case_[1].seqments);
segments.should.be.eql(case_[1].segments);
});
});

0 comments on commit 0c18298

Please sign in to comment.