aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/js/node/path/path.test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/js/node/path/path.test.js b/test/js/node/path/path.test.js
index 86807b325..d2880f124 100644
--- a/test/js/node/path/path.test.js
+++ b/test/js/node/path/path.test.js
@@ -13,6 +13,28 @@ it("should not inherit Object.prototype", () => {
expect(path).not.toHaveProperty("toString");
});
+it("path.dirname", () => {
+ const fixtures = [
+ ["yo", "."],
+ ["/yo", "/"],
+ ["/yo/", "/"],
+ ["/yo/123", "/yo"],
+ [".", "."],
+ ["../", "."],
+ ["../../", ".."],
+ ["../../foo", "../.."],
+ ["../../foo/../", "../../foo"],
+ ["/foo/../", "/foo"],
+ ["../../foo/../bar", "../../foo/.."],
+ ];
+ for (const [input, expected] of fixtures) {
+ expect(path.posix.dirname(input)).toBe(expected);
+ if (process.platform !== "win32") {
+ expect(path.dirname(input)).toBe(expected);
+ }
+ }
+});
+
it("path.basename", () => {
strictEqual(path.basename(file), "path.test.js");
strictEqual(path.basename(file, ".js"), "path.test");