Skip to content

Commit

Permalink
Add tests for no-separator scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
elvisvoer committed Jan 21, 2024
1 parent 2169140 commit c3aae30
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/b-path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ describe("b-path", () => {
[
[{}, ""],
[{ root: "/root" }, "/root"],
[{ root: "/root", name: "file", ext: ".txt" }, "/root/file.txt"],
// only root is present so no separator is included
[{ root: "/root", name: "file", ext: ".txt" }, "/rootfile.txt"],
[{ root: "/root/", name: "file", ext: ".txt" }, "/root/file.txt"],
// should add the extension "." if missing
[{ root: "/root", name: "file", ext: "txt" }, "/root/file.txt"],
[{ root: "/root/", name: "file", ext: "txt" }, "/root/file.txt"],
// should ignore 'name' and 'ext' if 'base' is present
[{ root: "/root", base: "base.sh", name: "file", ext: ".txt" }, "/root/base.sh"],
[{ root: "/root/", base: "base.sh", name: "file", ext: ".txt" }, "/root/base.sh"],
// should ignore 'root' if 'dir' is present
[{ root: "/root", dir: "/dir", base: "file.txt"}, "/dir/file.txt"],
[{ root: "/root/", dir: "/dir", base: "file.txt"}, "/dir/file.txt"],
].forEach(([input, result]) => {
it(`path.format(${JSON.stringify(
input
Expand Down

0 comments on commit c3aae30

Please sign in to comment.