Skip to content

Commit fa08b7d

Browse files
committed
added unit tests
1 parent 95e62e8 commit fa08b7d

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

test/spec-runner.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ const {
99
HeaderError,
1010
splitOutput,
1111
getRequestLogger,
12+
isAbsolutePosixPath,
13+
isAbsoluteWindowsPath,
1214
} = require("../lib/util");
1315
const { version } = require("../package.json");
1416

@@ -329,4 +331,24 @@ script.cgi`);
329331
);
330332
});
331333
});
334+
describe("isAbsolutePosixPath", () => {
335+
it("should return true", async () => {
336+
assert.strictEqual(isAbsolutePosixPath("/usr/bin/perl"), true);
337+
});
338+
it("should return false", async () => {
339+
assert.strictEqual(isAbsolutePosixPath("perl"), false);
340+
assert.strictEqual(isAbsolutePosixPath("usr/bin/perl"), false);
341+
});
342+
});
343+
describe("isAbsoluteWindowsPath", () => {
344+
it("should return true", async () => {
345+
assert.strictEqual(isAbsoluteWindowsPath("C:\\Program Files\\perl"), true);
346+
assert.strictEqual(isAbsoluteWindowsPath("C:/Program Files/perl"), true);
347+
assert.strictEqual(isAbsoluteWindowsPath("\\\\volume\\perl"), true);
348+
});
349+
it("should return false", async () => {
350+
assert.strictEqual(isAbsoluteWindowsPath("perl"), false);
351+
assert.strictEqual(isAbsoluteWindowsPath("Program Files\\perl"), false);
352+
});
353+
});
332354
});

0 commit comments

Comments
 (0)