aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/os.test.js
diff options
context:
space:
mode:
authorGravatar Ciro Spaciari <ciro.spaciari@gmail.com> 2023-03-02 22:33:25 -0300
committerGravatar GitHub <noreply@github.com> 2023-03-02 17:33:25 -0800
commit27c35791185bd85337e312e12c87d5c22d7f3a52 (patch)
tree037beac2c11147afc06881c6f89a9d07b43d144e /test/bun.js/os.test.js
parent3852a52601757d45a17a4a26fb3f6361e4b1bac4 (diff)
downloadbun-27c35791185bd85337e312e12c87d5c22d7f3a52.tar.gz
bun-27c35791185bd85337e312e12c87d5c22d7f3a52.tar.zst
bun-27c35791185bd85337e312e12c87d5c22d7f3a52.zip
fix(os.tmpdir()) strip trailing slash on *unix machines (#2276)
* fix(os.tmpdir()) strip trailing slash on *unix machines * make use of strings.withoutTrailingSlash(dir);
Diffstat (limited to '')
-rw-r--r--test/bun.js/os.test.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/bun.js/os.test.js b/test/bun.js/os.test.js
index 122969337..ea685cdb7 100644
--- a/test/bun.js/os.test.js
+++ b/test/bun.js/os.test.js
@@ -42,7 +42,11 @@ it("tmpdir", () => {
expect(os.tmpdir()).toBe(process.env.TEMP || process.env.TMP);
expect(os.tmpdir()).toBe(`${process.env.SystemRoot || process.env.windir}\\temp`);
} else {
- expect(os.tmpdir()).toBe(process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp");
+ let dir = process.env.TMPDIR || process.env.TMP || process.env.TEMP || "/tmp";
+ if (dir.length > 1 && dir.endsWith("/")) {
+ dir = dir.substring(0, dir.length - 1);
+ }
+ expect(os.tmpdir()).toBe(dir);
}
});
@@ -110,7 +114,8 @@ it("networkInterfaces", () => {
expect(typeof nI.family === "string").toBe(true);
expect(typeof nI.mac === "string").toBe(true);
expect(typeof nI.internal === "boolean").toBe(true);
- if (nI.cidr) // may be null
+ if (nI.cidr)
+ // may be null
expect(typeof nI.cidr).toBe("string");
}
}