test(image-stream): Test more compression methods (#1565)

* test(image-stream): Add more zip compression methods
* test(image-stream): Add more dmg compression methods
* test(image-stream): Add bz2 level 9 test

Change-Type: patch
This commit is contained in:
Jonas Hermsmeier 2017-07-03 23:35:06 +02:00 committed by GitHub
parent 5f5a4b61b0
commit f1ddf07a45
11 changed files with 78 additions and 3 deletions

View File

@ -29,9 +29,15 @@ describe('ImageStream: BZ2', function() {
this.timeout(20000);
describe('.getFromFilePath()', function() {
describe('compression method', function() {
describe('given a bz2 image', function() {
describe('bzip2 level 9', function() {
tester.extractFromFilePath(
path.join(BZ2_PATH, 'etcher-test-9.img.bz2'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
describe('bzip2 level 1', function() {
tester.extractFromFilePath(
path.join(BZ2_PATH, 'etcher-test.img.bz2'),
path.join(IMAGES_PATH, 'etcher-test.img'));

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -27,7 +27,40 @@ const tester = require('./tester');
describe('ImageStream: DMG', function() {
this.timeout(20000);
describe('compression method', function() {
describe('NONE', function() {
tester.extractFromFilePath(
path.join(DMG_PATH, 'etcher-test-raw.dmg'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
describe('UDCO (ADC)', function() {
tester.extractFromFilePath(
path.join(DMG_PATH, 'etcher-test-adc.dmg'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
describe('UDZO (ZLIB)', function() {
tester.extractFromFilePath(
path.join(DMG_PATH, 'etcher-test-zlib.dmg'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
describe('UDBZ (BZIP2)', function() {
tester.extractFromFilePath(
path.join(DMG_PATH, 'etcher-test-bz2.dmg'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
// NOTE: Skipped, as LZFSE is not supported by `udif` module yet
describe.skip('ULFO (LZFSE)', function() {
tester.extractFromFilePath(
path.join(DMG_PATH, 'etcher-test-lzfse.dmg'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
});
context('zlib compressed', function() {

View File

@ -69,6 +69,42 @@ describe('ImageStream: ZIP', function() {
});
describe('compression method', function() {
context('DEFLATE', function() {
tester.extractFromFilePath(
path.join(ZIP_PATH, 'zip-deflate.zip'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
// NOTE: These tests are intentionally skipped, as the
// zip library we're currently using only supports deflate
context.skip('DEFLATE64', function() {
tester.extractFromFilePath(
path.join(ZIP_PATH, 'zip-deflate64.zip'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
context.skip('PPMD', function() {
tester.extractFromFilePath(
path.join(ZIP_PATH, 'zip-ppmd.zip'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
context.skip('BZIP2', function() {
tester.extractFromFilePath(
path.join(ZIP_PATH, 'zip-bzip2.zip'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
context.skip('LZMA', function() {
tester.extractFromFilePath(
path.join(ZIP_PATH, 'zip-lzma.zip'),
path.join(IMAGES_PATH, 'etcher-test.img'));
});
});
describe('.getImageMetadata()', function() {
it('should return the correct metadata', function() {