mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
test(image-stream): Fix test image data (#1535)
This updates the base test image to be a complete, but small disk image, as thre previous image was quite large for running tests (32MB), and was chopped off at an arbitrary position, causing other tools to fail on it as an input. Change-Type: patch
This commit is contained in:
parent
dbc8aa159d
commit
4f4c606949
@ -33,8 +33,8 @@ describe('ImageStream: BZ2', function() {
|
|||||||
|
|
||||||
describe('given a bz2 image', function() {
|
describe('given a bz2 image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(BZ2_PATH, 'raspberrypi.img.bz2'),
|
path.join(BZ2_PATH, 'etcher-test.img.bz2'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -42,7 +42,7 @@ describe('ImageStream: BZ2', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(BZ2_PATH, 'raspberrypi.img.bz2');
|
const image = path.join(BZ2_PATH, 'etcher-test.img.bz2');
|
||||||
const expectedSize = fs.statSync(image).size;
|
const expectedSize = fs.statSync(image).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
|
BIN
tests/image-stream/data/bz2/etcher-test.img.bz2
Normal file
BIN
tests/image-stream/data/bz2/etcher-test.img.bz2
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/image-stream/data/dmg/etcher-test-raw.dmg
Normal file
BIN
tests/image-stream/data/dmg/etcher-test-raw.dmg
Normal file
Binary file not shown.
BIN
tests/image-stream/data/dmg/etcher-test-zlib.dmg
Normal file
BIN
tests/image-stream/data/dmg/etcher-test-zlib.dmg
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/image-stream/data/gz/etcher-test.img.gz
Normal file
BIN
tests/image-stream/data/gz/etcher-test.img.gz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/image-stream/data/images/etcher-test.iso
Normal file
BIN
tests/image-stream/data/images/etcher-test.iso
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/image-stream/data/metadata/zip/etcher-test-with-bmap.zip
Normal file
BIN
tests/image-stream/data/metadata/zip/etcher-test-with-bmap.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
tests/image-stream/data/metadata/zip/etcher-test-with-logo.zip
Normal file
BIN
tests/image-stream/data/metadata/zip/etcher-test-with-logo.zip
Normal file
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.
BIN
tests/image-stream/data/xz/etcher-test.img.xz
Normal file
BIN
tests/image-stream/data/xz/etcher-test.img.xz
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/image-stream/data/zip/zip-directory-etcher-test-only.zip
Normal file
BIN
tests/image-stream/data/zip/zip-directory-etcher-test-only.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -29,14 +29,14 @@ describe('ImageStream: DMG', function() {
|
|||||||
|
|
||||||
this.timeout(20000);
|
this.timeout(20000);
|
||||||
|
|
||||||
context('compressed', function() {
|
context('zlib compressed', function() {
|
||||||
|
|
||||||
describe('.getFromFilePath()', function() {
|
describe('.getFromFilePath()', function() {
|
||||||
|
|
||||||
describe('given an dmg image', function() {
|
describe('given an dmg image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(DMG_PATH, 'zlib-compressed.dmg'),
|
path.join(DMG_PATH, 'etcher-test-zlib.dmg'),
|
||||||
path.join(IMAGES_PATH, 'zlib-compressed.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -44,8 +44,8 @@ describe('ImageStream: DMG', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(DMG_PATH, 'zlib-compressed.dmg');
|
const image = path.join(DMG_PATH, 'etcher-test-zlib.dmg');
|
||||||
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'zlib-compressed.img')).size;
|
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||||
const compressedSize = fs.statSync(image).size;
|
const compressedSize = fs.statSync(image).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
@ -73,8 +73,8 @@ describe('ImageStream: DMG', function() {
|
|||||||
|
|
||||||
describe('given an dmg image', function() {
|
describe('given an dmg image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(DMG_PATH, 'raw.dmg'),
|
path.join(DMG_PATH, 'etcher-test-raw.dmg'),
|
||||||
path.join(IMAGES_PATH, 'raw.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -82,8 +82,8 @@ describe('ImageStream: DMG', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(DMG_PATH, 'raw.dmg');
|
const image = path.join(DMG_PATH, 'etcher-test-raw.dmg');
|
||||||
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'raw.img')).size;
|
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||||
const compressedSize = fs.statSync(image).size;
|
const compressedSize = fs.statSync(image).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
|
@ -33,8 +33,8 @@ describe('ImageStream: GZ', function() {
|
|||||||
|
|
||||||
describe('given a gz image', function() {
|
describe('given a gz image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(GZ_PATH, 'raspberrypi.img.gz'),
|
path.join(GZ_PATH, 'etcher-test.img.gz'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -42,9 +42,9 @@ describe('ImageStream: GZ', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(GZ_PATH, 'raspberrypi.img.gz');
|
const image = path.join(GZ_PATH, 'etcher-test.img.gz');
|
||||||
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'raspberrypi.img')).size;
|
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||||
const compressedSize = fs.statSync(path.join(GZ_PATH, 'raspberrypi.img.gz')).size;
|
const compressedSize = fs.statSync(path.join(GZ_PATH, 'etcher-test.img.gz')).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
m.chai.expect(metadata).to.deep.equal({
|
m.chai.expect(metadata).to.deep.equal({
|
||||||
|
@ -32,8 +32,8 @@ describe('ImageStream: IMG', function() {
|
|||||||
|
|
||||||
describe('given an img image', function() {
|
describe('given an img image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'),
|
path.join(IMAGES_PATH, 'etcher-test.img'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -41,7 +41,7 @@ describe('ImageStream: IMG', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(IMAGES_PATH, 'raspberrypi.img');
|
const image = path.join(IMAGES_PATH, 'etcher-test.img');
|
||||||
const expectedSize = fs.statSync(image).size;
|
const expectedSize = fs.statSync(image).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
|
@ -32,8 +32,8 @@ describe('ImageStream: ISO', function() {
|
|||||||
|
|
||||||
describe('given an iso image', function() {
|
describe('given an iso image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.iso'),
|
path.join(IMAGES_PATH, 'etcher-test.iso'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.iso'));
|
path.join(IMAGES_PATH, 'etcher-test.iso'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -41,7 +41,7 @@ describe('ImageStream: ISO', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(IMAGES_PATH, 'raspberrypi.iso');
|
const image = path.join(IMAGES_PATH, 'etcher-test.iso');
|
||||||
const expectedSize = fs.statSync(image).size;
|
const expectedSize = fs.statSync(image).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
|
@ -41,18 +41,17 @@ describe('ImageStream: Metadata ZIP', function() {
|
|||||||
describe('given an archive with an invalid `manifest.json`', function() {
|
describe('given an archive with an invalid `manifest.json`', function() {
|
||||||
|
|
||||||
tester.expectError(
|
tester.expectError(
|
||||||
path.join(ZIP_PATH, 'rpi-invalid-manifest.zip'),
|
path.join(ZIP_PATH, 'etcher-test-invalid-manifest.zip'),
|
||||||
'Invalid archive manifest.json');
|
'Invalid archive manifest.json');
|
||||||
|
|
||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should be rejected with an error', function(done) {
|
it('should be rejected with an error', function() {
|
||||||
const image = path.join(ZIP_PATH, 'rpi-invalid-manifest.zip');
|
const image = path.join(ZIP_PATH, 'etcher-test-invalid-manifest.zip');
|
||||||
|
|
||||||
imageStream.getImageMetadata(image).catch((error) => {
|
return imageStream.getImageMetadata(image).catch((error) => {
|
||||||
m.chai.expect(error).to.be.an.instanceof(Error);
|
m.chai.expect(error).to.be.an.instanceof(Error);
|
||||||
m.chai.expect(error.message).to.equal('Invalid archive manifest.json');
|
m.chai.expect(error.message).to.equal('Invalid archive manifest.json');
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -62,14 +61,14 @@ describe('ImageStream: Metadata ZIP', function() {
|
|||||||
|
|
||||||
describe('given an archive with a `manifest.json`', function() {
|
describe('given an archive with a `manifest.json`', function() {
|
||||||
|
|
||||||
const archive = path.join(ZIP_PATH, 'rpi-with-manifest.zip');
|
const archive = path.join(ZIP_PATH, 'etcher-test-with-manifest.zip');
|
||||||
|
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
archive,
|
archive,
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
|
|
||||||
it('should read the manifest name property', function() {
|
it('should read the manifest name property', function() {
|
||||||
return testMetadataProperty(archive, 'name', 'Raspberry Pi');
|
return testMetadataProperty(archive, 'name', 'Etcher Test');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should read the manifest version property', function() {
|
it('should read the manifest version property', function() {
|
||||||
@ -77,16 +76,16 @@ describe('ImageStream: Metadata ZIP', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should read the manifest url property', function() {
|
it('should read the manifest url property', function() {
|
||||||
return testMetadataProperty(archive, 'url', 'https://www.raspberrypi.org');
|
return testMetadataProperty(archive, 'url', 'https://www.example.com');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should read the manifest supportUrl property', function() {
|
it('should read the manifest supportUrl property', function() {
|
||||||
const expectedValue = 'https://www.raspberrypi.org/forums/';
|
const expectedValue = 'https://www.example.com/support/';
|
||||||
return testMetadataProperty(archive, 'supportUrl', expectedValue);
|
return testMetadataProperty(archive, 'supportUrl', expectedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should read the manifest releaseNotesUrl property', function() {
|
it('should read the manifest releaseNotesUrl property', function() {
|
||||||
const expectedValue = 'http://downloads.raspberrypi.org/raspbian/release_notes.txt';
|
const expectedValue = 'http://downloads.example.com/release_notes.txt';
|
||||||
return testMetadataProperty(archive, 'releaseNotesUrl', expectedValue);
|
return testMetadataProperty(archive, 'releaseNotesUrl', expectedValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -110,7 +109,7 @@ describe('ImageStream: Metadata ZIP', function() {
|
|||||||
|
|
||||||
describe('given an archive with a `logo.svg`', function() {
|
describe('given an archive with a `logo.svg`', function() {
|
||||||
|
|
||||||
const archive = path.join(ZIP_PATH, 'rpi-with-logo.zip');
|
const archive = path.join(ZIP_PATH, 'etcher-test-with-logo.zip');
|
||||||
|
|
||||||
const logo = [
|
const logo = [
|
||||||
'<svg xmlns="http://www.w3.org/2000/svg">',
|
'<svg xmlns="http://www.w3.org/2000/svg">',
|
||||||
@ -127,19 +126,18 @@ describe('ImageStream: Metadata ZIP', function() {
|
|||||||
|
|
||||||
describe('given an archive with a bmap file', function() {
|
describe('given an archive with a bmap file', function() {
|
||||||
|
|
||||||
const archive = path.join(ZIP_PATH, 'rpi-with-bmap.zip');
|
const archive = path.join(ZIP_PATH, 'etcher-test-with-bmap.zip');
|
||||||
|
|
||||||
const bmap = [
|
const bmap = [
|
||||||
'<?xml version="1.0" ?>',
|
'<?xml version="1.0" ?>',
|
||||||
'<bmap version="1.3">',
|
'<bmap version="1.3">',
|
||||||
' <ImageSize> 36864 </ImageSize>',
|
' <ImageSize> 5242880 </ImageSize>',
|
||||||
' <BlockSize> 4096 </BlockSize>',
|
' <BlockSize> 4096 </BlockSize>',
|
||||||
' <BlocksCount> 9 </BlocksCount>',
|
' <BlocksCount> 1280 </BlocksCount>',
|
||||||
' <MappedBlocksCount> 4 </MappedBlocksCount>',
|
' <MappedBlocksCount> 1280 </MappedBlocksCount>',
|
||||||
' <BmapFileSHA1> d90f372215cbbef8801caca7b1dd7e587b2142cc </BmapFileSHA1>',
|
' <BmapFileSHA1> cc6f077565c73a46198777b259c231875df4e709 </BmapFileSHA1>',
|
||||||
' <BlockMap>',
|
' <BlockMap>',
|
||||||
' <Range sha1="193edb53bde599f58369f4e83a6c5d54b96819ce"> 0-1 </Range>',
|
' <Range sha1="7b7d6e1fc44ef224a8c57d3ec6ffc3717c428a14"> 0-1280 </Range>',
|
||||||
' <Range sha1="193edb53bde599f58369f4e83a6c5d54b96819ce"> 7-8 </Range>',
|
|
||||||
' </BlockMap>',
|
' </BlockMap>',
|
||||||
'</bmap>',
|
'</bmap>',
|
||||||
''
|
''
|
||||||
@ -153,10 +151,10 @@ describe('ImageStream: Metadata ZIP', function() {
|
|||||||
|
|
||||||
describe('given an archive with instructions', function() {
|
describe('given an archive with instructions', function() {
|
||||||
|
|
||||||
const archive = path.join(ZIP_PATH, 'rpi-with-instructions.zip');
|
const archive = path.join(ZIP_PATH, 'etcher-test-with-instructions.zip');
|
||||||
|
|
||||||
const instructions = [
|
const instructions = [
|
||||||
'# Raspberry Pi Next Steps',
|
'# Example Next Steps',
|
||||||
'',
|
'',
|
||||||
'Lorem ipsum dolor sit amet.',
|
'Lorem ipsum dolor sit amet.',
|
||||||
''
|
''
|
||||||
|
@ -27,56 +27,56 @@ describe('ImageStream: Utils', function() {
|
|||||||
describe('.getArchiveMimeType()', function() {
|
describe('.getArchiveMimeType()', function() {
|
||||||
|
|
||||||
it('should resolve application/x-bzip2 for a bz2 archive', function() {
|
it('should resolve application/x-bzip2 for a bz2 archive', function() {
|
||||||
const file = path.join(DATA_PATH, 'bz2', 'raspberrypi.img.bz2');
|
const file = path.join(DATA_PATH, 'bz2', 'etcher-test.img.bz2');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/x-bzip2');
|
m.chai.expect(type).to.equal('application/x-bzip2');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/x-xz for a xz archive', function() {
|
it('should resolve application/x-xz for a xz archive', function() {
|
||||||
const file = path.join(DATA_PATH, 'xz', 'raspberrypi.img.xz');
|
const file = path.join(DATA_PATH, 'xz', 'etcher-test.img.xz');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/x-xz');
|
m.chai.expect(type).to.equal('application/x-xz');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/gzip for a gz archive', function() {
|
it('should resolve application/gzip for a gz archive', function() {
|
||||||
const file = path.join(DATA_PATH, 'gz', 'raspberrypi.img.gz');
|
const file = path.join(DATA_PATH, 'gz', 'etcher-test.img.gz');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/gzip');
|
m.chai.expect(type).to.equal('application/gzip');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/zip for a zip archive', function() {
|
it('should resolve application/zip for a zip archive', function() {
|
||||||
const file = path.join(DATA_PATH, 'zip', 'zip-directory-rpi-only.zip');
|
const file = path.join(DATA_PATH, 'zip', 'zip-directory-etcher-only.zip');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/zip');
|
m.chai.expect(type).to.equal('application/zip');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/octet-stream for an uncompressed image', function() {
|
it('should resolve application/octet-stream for an uncompressed image', function() {
|
||||||
const file = path.join(DATA_PATH, 'images', 'raspberrypi.img');
|
const file = path.join(DATA_PATH, 'images', 'etcher-test.img');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/octet-stream');
|
m.chai.expect(type).to.equal('application/octet-stream');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/x-iso9660-image for an uncompressed iso', function() {
|
it('should resolve application/x-iso9660-image for an uncompressed iso', function() {
|
||||||
const file = path.join(DATA_PATH, 'images', 'raspberrypi.iso');
|
const file = path.join(DATA_PATH, 'images', 'etcher-test.iso');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/x-iso9660-image');
|
m.chai.expect(type).to.equal('application/x-iso9660-image');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/x-apple-diskimage for a compressed Apple disk image', function() {
|
it('should resolve application/x-apple-diskimage for a compressed Apple disk image', function() {
|
||||||
const file = path.join(DATA_PATH, 'dmg', 'zlib-compressed.dmg');
|
const file = path.join(DATA_PATH, 'dmg', 'etcher-test-zlib.dmg');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/x-apple-diskimage');
|
m.chai.expect(type).to.equal('application/x-apple-diskimage');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve application/x-apple-diskimage for an uncompressed Apple disk image', function() {
|
it('should resolve application/x-apple-diskimage for an uncompressed Apple disk image', function() {
|
||||||
const file = path.join(DATA_PATH, 'dmg', 'raw.dmg');
|
const file = path.join(DATA_PATH, 'dmg', 'etcher-test-raw.dmg');
|
||||||
return utils.getArchiveMimeType(file).then((type) => {
|
return utils.getArchiveMimeType(file).then((type) => {
|
||||||
m.chai.expect(type).to.equal('application/x-apple-diskimage');
|
m.chai.expect(type).to.equal('application/x-apple-diskimage');
|
||||||
});
|
});
|
||||||
|
@ -33,8 +33,8 @@ describe('ImageStream: XZ', function() {
|
|||||||
|
|
||||||
describe('given a xz image', function() {
|
describe('given a xz image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(XZ_PATH, 'raspberrypi.img.xz'),
|
path.join(XZ_PATH, 'etcher-test.img.xz'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -42,9 +42,9 @@ describe('ImageStream: XZ', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(XZ_PATH, 'raspberrypi.img.xz');
|
const image = path.join(XZ_PATH, 'etcher-test.img.xz');
|
||||||
const compressedSize = fs.statSync(image).size;
|
const compressedSize = fs.statSync(image).size;
|
||||||
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'raspberrypi.img')).size;
|
const uncompressedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
m.chai.expect(metadata).to.deep.equal({
|
m.chai.expect(metadata).to.deep.equal({
|
||||||
|
@ -51,14 +51,14 @@ describe('ImageStream: ZIP', function() {
|
|||||||
|
|
||||||
describe('given a zip directory containing only an image', function() {
|
describe('given a zip directory containing only an image', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(ZIP_PATH, 'zip-directory-rpi-only.zip'),
|
path.join(ZIP_PATH, 'zip-directory-etcher-test-only.zip'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('given a zip directory containing an image and other misc files', function() {
|
describe('given a zip directory containing an image and other misc files', function() {
|
||||||
tester.extractFromFilePath(
|
tester.extractFromFilePath(
|
||||||
path.join(ZIP_PATH, 'zip-directory-rpi-and-misc.zip'),
|
path.join(ZIP_PATH, 'zip-directory-etcher-test-and-misc.zip'),
|
||||||
path.join(IMAGES_PATH, 'raspberrypi.img'));
|
path.join(IMAGES_PATH, 'etcher-test.img'));
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -66,8 +66,8 @@ describe('ImageStream: ZIP', function() {
|
|||||||
describe('.getImageMetadata()', function() {
|
describe('.getImageMetadata()', function() {
|
||||||
|
|
||||||
it('should return the correct metadata', function() {
|
it('should return the correct metadata', function() {
|
||||||
const image = path.join(ZIP_PATH, 'zip-directory-rpi-only.zip');
|
const image = path.join(ZIP_PATH, 'zip-directory-etcher-test-only.zip');
|
||||||
const expectedSize = fs.statSync(path.join(IMAGES_PATH, 'raspberrypi.img')).size;
|
const expectedSize = fs.statSync(path.join(IMAGES_PATH, 'etcher-test.img')).size;
|
||||||
|
|
||||||
return imageStream.getImageMetadata(image).then((metadata) => {
|
return imageStream.getImageMetadata(image).then((metadata) => {
|
||||||
m.chai.expect(metadata).to.deep.equal({
|
m.chai.expect(metadata).to.deep.equal({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user