Skip to content

Commit

Permalink
Add tests for utils that remove leading slash
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuk committed Mar 30, 2022
1 parent d4702a7 commit 459ff79
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/asserts/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* global QUnit,JSZip,JSZipTestUtils */
'use strict';

var utils = require("../../lib/utils");

QUnit.module("utils");

QUnit.test("Paths are resolved correctly", function (assert) {
assert.strictEqual(utils.resolve("root\\a\\b"), "root/a/b");
assert.strictEqual(utils.resolve("root/a/b"), "root/a/b");
assert.strictEqual(utils.resolve("root/a/.."), "root");
assert.strictEqual(utils.resolve("root/a/../b"), "root/b");
assert.strictEqual(utils.resolve("root/a/./b"), "root/a/b");
assert.strictEqual(utils.resolve("root/../../../"), "");
assert.strictEqual(utils.resolve("////"), "");
assert.strictEqual(utils.resolve("/a/b/c"), "a/b/c");
assert.strictEqual(utils.resolve("a/b/c/"), "a/b/c/");
assert.strictEqual(utils.resolve("../../../../../a"), "a");
assert.strictEqual(utils.resolve("../app.js"), "app.js");
});

0 comments on commit 459ff79

Please sign in to comment.