diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-05-04 18:52:14 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-05-04 18:52:14 +0100 |
| commit | 80508a1a9828b5051e5514200d299c08698430b5 (patch) | |
| tree | 6d77d92533c752e8ecb17149e375629ec4c5af59 /tests | |
| parent | 9b9fc902b784090f4f6fafd866c7b35bf47f517f (diff) | |
Add test for unzipping a simple zip file
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-data/hello.zip | bin | 0 -> 120 bytes | |||
| -rw-r--r-- | tests/unzip.tests.js | 10 |
2 files changed, 10 insertions, 0 deletions
diff --git a/tests/test-data/hello.zip b/tests/test-data/hello.zip Binary files differnew file mode 100644 index 0000000..613eb52 --- /dev/null +++ b/tests/test-data/hello.zip diff --git a/tests/unzip.tests.js b/tests/unzip.tests.js index 95aa26f..b505840 100644 --- a/tests/unzip.tests.js +++ b/tests/unzip.tests.js @@ -1,4 +1,5 @@ var assert = require("assert"); +var path = require("path"); var test = require("./testing").test; var unzip = require("../lib/unzip"); @@ -11,4 +12,13 @@ describe("unzip", function() { assert.equal("Could not find file in options", error.message); }); }); + + test("unzip can open local zip file", function() { + var zipPath = path.join(__dirname, "test-data/hello.zip"); + return unzip.openZip({path: zipPath}).then(function(zipFile) { + return zipFile.read("hello", "utf8"); + }).then(function(contents) { + assert.equal(contents, "Hello world\n"); + }); + }); }); |
