Skip to content

Commit

Permalink
Add test for v3 crx files
Browse files Browse the repository at this point in the history
  • Loading branch information
hpohlmeyer committed Oct 19, 2018
1 parent 1ab2aaf commit 8526c86
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
File renamed without changes.
Binary file added test/fixtures/extension-v3.crx
Binary file not shown.
20 changes: 17 additions & 3 deletions test/index-spec.js
Expand Up @@ -18,11 +18,25 @@ describe("unzip-crx", () => {
tempDir = temp.mkdirSync("unzip-crx-test-files");
});

it("should unpack the given crx file", (done) => {
it("should unpack the given crx v2 file", (done) => {
const unzipPath = path.resolve(tempDir, "ext");
const readmeFile = path.resolve(tempDir, "ext/README.md");

unzip("./test/fixtures/extension.crx", unzipPath)
unzip("./test/fixtures/extension-v2.crx", unzipPath)
.then(() => {
const file = fs.readFileSync(readmeFile, "utf8");

expect(file, "to equal", "# Crazy Readme File");
done();
})
.catch((err) => done(err));
});

it("should unpack the given crx v3 file", (done) => {
const unzipPath = path.resolve(tempDir, "ext");
const readmeFile = path.resolve(tempDir, "ext/README.md");

unzip("./test/fixtures/extension-v3.crx", unzipPath)
.then(() => {
const file = fs.readFileSync(readmeFile, "utf8");

Expand Down Expand Up @@ -80,7 +94,7 @@ describe("unzip-crx", () => {
fs.chmodSync(unzipPath, "644");

return expect(
unzip("./test/fixtures/extension.crx", unzipPath),
unzip("./test/fixtures/extension-v2.crx", unzipPath),
"to be rejected with",
/EACCES: permission denied/
);
Expand Down

0 comments on commit 8526c86

Please sign in to comment.