diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/zipfile.tests.js | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/test/zipfile.tests.js b/test/zipfile.tests.js index f6c38d4..8c2f6c1 100644 --- a/test/zipfile.tests.js +++ b/test/zipfile.tests.js @@ -17,48 +17,24 @@ test('file in zip can be read after being written', function() { }); }); -test('leading slash in path is stripped if set when reading', function() { - var zip = emptyZipFile(); - assert(!zip.exists("/song/title")); - - zip.write("song/title", "Dark Blue"); - - assert(zip.exists("/song/title")); - return zip.read("/song/title", "utf8").then(function(contents) { - assert.equal(contents, "Dark Blue"); - }); -}); - -test('leading slash in path is stripped if set when writing', function() { - var zip = emptyZipFile(); - assert(!zip.exists("song/title")); - - zip.write("/song/title", "Dark Blue"); - - assert(zip.exists("song/title")); - return zip.read("song/title", "utf8").then(function(contents) { - assert.equal(contents, "Dark Blue"); - }); -}); - function emptyZipFile() { var zip = new JSZip(); var buffer = zip.generate({type: "arraybuffer"}); return zipfile.openArrayBuffer(buffer); } -test("joinZipPath", { - "joins relative path to base using forward slash": function() { +test("uriToZipEntryName", { + "when path does not have leading slash then path is resolved relative to base": function() { assert.equal( - zipfile.joinZipPath("one/two", "three/four"), + zipfile.uriToZipEntryName("one/two", "three/four"), "one/two/three/four" ) }, - "joining base to absolute path ignores base": function() { + "when path has leading slash then base is ignored": function() { assert.equal( - zipfile.joinZipPath("one/two", "/three/four"), - "/three/four" + zipfile.uriToZipEntryName("one/two", "/three/four"), + "three/four" ) } }); |
