aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-17 20:07:08 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-04-17 20:07:08 -0700
commit9e1745ee1f5844e6ab89135e776552d2ad1ad684 (patch)
tree133981a2dbfb1cc7fe4b566f198cb8dd87c83921 /test
parent05cb5bb659a7213fc94c67d5836a9f9fb1517a30 (diff)
downloadbun-9e1745ee1f5844e6ab89135e776552d2ad1ad684.tar.gz
bun-9e1745ee1f5844e6ab89135e776552d2ad1ad684.tar.zst
bun-9e1745ee1f5844e6ab89135e776552d2ad1ad684.zip
Fixes #2676
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");