mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-27 21:26:38 +00:00
fix(tests): Fix gui tests
Change-type: patch Signed-off-by: Alexis Svinartchouk <alexis@resin.io>
This commit is contained in:
parent
8d79103392
commit
871db09447
@ -93,13 +93,9 @@ exports.deselectOtherDrives = (driveDevice) => {
|
|||||||
* @example
|
* @example
|
||||||
* selectionState.selectImage({
|
* selectionState.selectImage({
|
||||||
* path: 'foo.img',
|
* path: 'foo.img',
|
||||||
* size: {
|
* size: 1000000000,
|
||||||
* original: 1000000000,
|
* compressedSize: 1000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 1000000000
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
exports.selectImage = (image) => {
|
exports.selectImage = (image) => {
|
||||||
|
@ -251,7 +251,7 @@ const storeReducer = (state = DEFAULT_STATE, action) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.data.percentage !== undefined) {
|
if (!_.isUndefined(action.data.percentage)) {
|
||||||
if (!utils.isValidPercentage(action.data.percentage)) {
|
if (!utils.isValidPercentage(action.data.percentage)) {
|
||||||
throw errors.createError({
|
throw errors.createError({
|
||||||
title: `Invalid state percentage: ${action.data.percentage}`
|
title: `Invalid state percentage: ${action.data.percentage}`
|
||||||
@ -426,11 +426,21 @@ const storeReducer = (state = DEFAULT_STATE, action) => {
|
|||||||
const MINIMUM_IMAGE_SIZE = 0
|
const MINIMUM_IMAGE_SIZE = 0
|
||||||
|
|
||||||
// eslint-disable-next-line no-undefined
|
// eslint-disable-next-line no-undefined
|
||||||
if ((action.data.size !== undefined) && (action.data.size < MINIMUM_IMAGE_SIZE)) {
|
if (action.data.size !== undefined) {
|
||||||
|
if ((action.data.size < MINIMUM_IMAGE_SIZE) || !_.isInteger(action.data.size)) {
|
||||||
throw errors.createError({
|
throw errors.createError({
|
||||||
title: `Invalid image size: ${action.data.size}`
|
title: `Invalid image size: ${action.data.size}`
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_.isUndefined(action.data.compressedSize)) {
|
||||||
|
if ((action.data.compressedSize < MINIMUM_IMAGE_SIZE) || !_.isInteger(action.data.compressedSize)) {
|
||||||
|
throw errors.createError({
|
||||||
|
title: `Invalid image compressed size: ${action.data.compressedSize}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (action.data.url && !_.isString(action.data.url)) {
|
if (action.data.url && !_.isString(action.data.url)) {
|
||||||
throw errors.createError({
|
throw errors.createError({
|
||||||
|
@ -110,13 +110,9 @@ module.exports = function (
|
|||||||
* @example
|
* @example
|
||||||
* FlashController.flashImageToDrive({
|
* FlashController.flashImageToDrive({
|
||||||
* path: 'rpi.img',
|
* path: 'rpi.img',
|
||||||
* size: {
|
* size: 1000000000,
|
||||||
* original: 1000000000,
|
* compressedSize: 1000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 1000000000
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }, [
|
* }, [
|
||||||
* '/dev/disk2',
|
* '/dev/disk2',
|
||||||
* '/dev/disk5'
|
* '/dev/disk5'
|
||||||
|
@ -104,13 +104,9 @@ exports.isSystemDrive = (drive) => {
|
|||||||
* ]
|
* ]
|
||||||
* }, {
|
* }, {
|
||||||
* path: '/Volumes/Untitled/image.img',
|
* path: '/Volumes/Untitled/image.img',
|
||||||
* size: {
|
* size: 1000000000,
|
||||||
* original: 1000000000,
|
* compressedSize: 1000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 1000000000
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* })) {
|
* })) {
|
||||||
* console.log('This drive is a source drive!');
|
* console.log('This drive is a source drive!');
|
||||||
* }
|
* }
|
||||||
@ -144,13 +140,9 @@ exports.isSourceDrive = (drive, image) => {
|
|||||||
* size: 1000000000
|
* size: 1000000000
|
||||||
* }, {
|
* }, {
|
||||||
* path: 'rpi.img',
|
* path: 'rpi.img',
|
||||||
* size: {
|
* size: 1000000000,
|
||||||
* original: 1000000000,
|
* compressedSize: 1000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 1000000000
|
|
||||||
* }
|
|
||||||
* },
|
|
||||||
* })) {
|
* })) {
|
||||||
* console.log('We can flash the image to this drive!');
|
* console.log('We can flash the image to this drive!');
|
||||||
* }
|
* }
|
||||||
@ -158,12 +150,12 @@ exports.isSourceDrive = (drive, image) => {
|
|||||||
exports.isDriveLargeEnough = (drive, image) => {
|
exports.isDriveLargeEnough = (drive, image) => {
|
||||||
const driveSize = _.get(drive, [ 'size' ], UNKNOWN_SIZE)
|
const driveSize = _.get(drive, [ 'size' ], UNKNOWN_SIZE)
|
||||||
|
|
||||||
if (_.get(image, [ 'size', 'final', 'estimation' ])) {
|
if (_.get(image, [ 'isSizeEstimated' ])) {
|
||||||
// If the drive size is smaller than the original image size, and
|
// If the drive size is smaller than the original image size, and
|
||||||
// the final image size is just an estimation, then we stop right
|
// the final image size is just an estimation, then we stop right
|
||||||
// here, based on the assumption that the final size will never
|
// here, based on the assumption that the final size will never
|
||||||
// be less than the original size.
|
// be less than the original size.
|
||||||
if (driveSize < _.get(image, [ 'size', 'original' ], UNKNOWN_SIZE)) {
|
if (driveSize < _.get(image, [ 'compressedSize' ], UNKNOWN_SIZE)) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,11 +166,7 @@ exports.isDriveLargeEnough = (drive, image) => {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return driveSize >= _.get(image, [
|
return driveSize >= _.get(image, [ 'size' ], UNKNOWN_SIZE)
|
||||||
'size',
|
|
||||||
'final',
|
|
||||||
'value'
|
|
||||||
], UNKNOWN_SIZE)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -220,13 +208,9 @@ exports.isDriveDisabled = (drive) => {
|
|||||||
* isReadOnly: false
|
* isReadOnly: false
|
||||||
* }, {
|
* }, {
|
||||||
* path: 'rpi.img',
|
* path: 'rpi.img',
|
||||||
* size: {
|
* size: 1000000000,
|
||||||
* original: 1000000000,
|
* compressedSize: 1000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 1000000000
|
|
||||||
* }
|
|
||||||
* },
|
|
||||||
* recommendedDriveSize: 2000000000
|
* recommendedDriveSize: 2000000000
|
||||||
* })) {
|
* })) {
|
||||||
* console.log('This drive is valid!');
|
* console.log('This drive is valid!');
|
||||||
@ -260,13 +244,9 @@ exports.isDriveValid = (drive, image) => {
|
|||||||
*
|
*
|
||||||
* const image = {
|
* const image = {
|
||||||
* path: 'rpi.img',
|
* path: 'rpi.img',
|
||||||
* size: {
|
* size: 2000000000,
|
||||||
* original: 2000000000,
|
* compressedSize: 2000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 2000000000
|
|
||||||
* }
|
|
||||||
* },
|
|
||||||
* recommendedDriveSize: 4000000000
|
* recommendedDriveSize: 4000000000
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
@ -337,13 +317,9 @@ exports.COMPATIBILITY_STATUS_TYPES = {
|
|||||||
*
|
*
|
||||||
* const image = {
|
* const image = {
|
||||||
* path: '/path/to/rpi.img',
|
* path: '/path/to/rpi.img',
|
||||||
* size: {
|
* size: 2000000000,
|
||||||
* original: 2000000000,
|
* compressedSize: 2000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 2000000000
|
|
||||||
* }
|
|
||||||
* },
|
|
||||||
* recommendedDriveSize: 4000000000
|
* recommendedDriveSize: 4000000000
|
||||||
* });
|
* });
|
||||||
*
|
*
|
||||||
@ -372,7 +348,7 @@ exports.getDriveImageCompatibilityStatuses = (drive, image) => {
|
|||||||
message: messages.compatibility.locked()
|
message: messages.compatibility.locked()
|
||||||
})
|
})
|
||||||
} else if (!_.isNil(drive) && !_.isNil(drive.size) && !exports.isDriveLargeEnough(drive, image)) {
|
} else if (!_.isNil(drive) && !_.isNil(drive.size) && !exports.isDriveLargeEnough(drive, image)) {
|
||||||
const imageSize = _.get(image, [ 'size', 'final', 'estimation' ]) ? image.size.original : image.size.final.value
|
const imageSize = _.get(image, [ 'isSizeEstimated' ]) ? image.size : image.compressedSize
|
||||||
const relativeBytes = imageSize - drive.size
|
const relativeBytes = imageSize - drive.size
|
||||||
statusList.push({
|
statusList.push({
|
||||||
type: exports.COMPATIBILITY_STATUS_TYPES.ERROR,
|
type: exports.COMPATIBILITY_STATUS_TYPES.ERROR,
|
||||||
@ -433,13 +409,9 @@ exports.getDriveImageCompatibilityStatuses = (drive, image) => {
|
|||||||
*
|
*
|
||||||
* const image = {
|
* const image = {
|
||||||
* path: '/path/to/rpi.img',
|
* path: '/path/to/rpi.img',
|
||||||
* size: {
|
* size: 2000000000,
|
||||||
* original: 2000000000,
|
* compressedSize: 2000000000,
|
||||||
* final: {
|
* isSizeEstimated: false,
|
||||||
* estimation: false,
|
|
||||||
* value: 2000000000
|
|
||||||
* }
|
|
||||||
* },
|
|
||||||
* recommendedDriveSize: 4000000000
|
* recommendedDriveSize: 4000000000
|
||||||
* })
|
* })
|
||||||
*
|
*
|
||||||
|
@ -154,13 +154,8 @@ describe('Model: availableDrives', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: this.imagePath,
|
path: this.imagePath,
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 2000000000
|
recommendedDriveSize: 2000000000
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -48,8 +48,8 @@ describe('Model: flashState', function () {
|
|||||||
successful: 0,
|
successful: 0,
|
||||||
failed: 0,
|
failed: 0,
|
||||||
percentage: 0,
|
percentage: 0,
|
||||||
speed: 0,
|
speed: null,
|
||||||
totalSpeed: 0
|
totalSpeed: null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -352,8 +352,8 @@ describe('Model: flashState', function () {
|
|||||||
successful: 0,
|
successful: 0,
|
||||||
failed: 0,
|
failed: 0,
|
||||||
percentage: 0,
|
percentage: 0,
|
||||||
speed: 0,
|
speed: null,
|
||||||
totalSpeed: 0
|
totalSpeed: null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -500,8 +500,8 @@ describe('Model: flashState', function () {
|
|||||||
successful: 0,
|
successful: 0,
|
||||||
failed: 0,
|
failed: 0,
|
||||||
percentage: 0,
|
percentage: 0,
|
||||||
speed: 0,
|
speed: null,
|
||||||
totalSpeed: 0
|
totalSpeed: null
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -390,13 +390,7 @@ describe('Model: selectionState', function () {
|
|||||||
this.image = {
|
this.image = {
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 1000000000,
|
recommendedDriveSize: 1000000000,
|
||||||
url: 'https://www.raspbian.org',
|
url: 'https://www.raspbian.org',
|
||||||
supportUrl: 'https://www.raspbian.org/forums/',
|
supportUrl: 'https://www.raspbian.org/forums/',
|
||||||
@ -491,13 +485,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'bar.img',
|
path: 'bar.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const imagePath = selectionState.getImagePath()
|
const imagePath = selectionState.getImagePath()
|
||||||
@ -527,13 +516,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const imagePath = selectionState.getImagePath()
|
const imagePath = selectionState.getImagePath()
|
||||||
@ -547,13 +531,8 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'foo.zip',
|
path: 'foo.zip',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
archiveExtension: 'zip',
|
archiveExtension: 'zip',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const imagePath = selectionState.getImagePath()
|
const imagePath = selectionState.getImagePath()
|
||||||
@ -565,13 +544,8 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'foo.xz',
|
path: 'foo.xz',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
archiveExtension: 'xz',
|
archiveExtension: 'xz',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const imagePath = selectionState.getImagePath()
|
const imagePath = selectionState.getImagePath()
|
||||||
@ -583,13 +557,8 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'something.linux-x86-64.gz',
|
path: 'something.linux-x86-64.gz',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
archiveExtension: 'gz',
|
archiveExtension: 'gz',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const imagePath = selectionState.getImagePath()
|
const imagePath = selectionState.getImagePath()
|
||||||
@ -600,13 +569,8 @@ describe('Model: selectionState', function () {
|
|||||||
m.chai.expect(function () {
|
m.chai.expect(function () {
|
||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Missing image fields: path')
|
}).to.throw('Missing image fields: path')
|
||||||
})
|
})
|
||||||
@ -616,13 +580,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 123,
|
path: 123,
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image path: 123')
|
}).to.throw('Invalid image path: 123')
|
||||||
})
|
})
|
||||||
@ -631,13 +590,8 @@ describe('Model: selectionState', function () {
|
|||||||
m.chai.expect(function () {
|
m.chai.expect(function () {
|
||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Missing image fields: extension')
|
}).to.throw('Missing image fields: extension')
|
||||||
})
|
})
|
||||||
@ -647,13 +601,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 1,
|
extension: 1,
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image extension: 1')
|
}).to.throw('Invalid image extension: 1')
|
||||||
})
|
})
|
||||||
@ -663,13 +612,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'iso',
|
extension: 'iso',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Missing image archive extension')
|
}).to.throw('Missing image archive extension')
|
||||||
})
|
})
|
||||||
@ -680,15 +624,10 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'iso',
|
extension: 'iso',
|
||||||
archiveExtension: 1,
|
archiveExtension: 1,
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image archive extension: 1')
|
}).to.throw('Missing image archive extension')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if the archive extension doesn\'t match the last path extension in a compressed image', function () {
|
it('should throw if the archive extension doesn\'t match the last path extension in a compressed image', function () {
|
||||||
@ -697,13 +636,8 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'foo.img.xz',
|
path: 'foo.img.xz',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
archiveExtension: 'gz',
|
archiveExtension: 'gz',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Image archive extension mismatch: gz and xz')
|
}).to.throw('Image archive extension mismatch: gz and xz')
|
||||||
})
|
})
|
||||||
@ -713,13 +647,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.ifg',
|
path: 'foo.ifg',
|
||||||
extension: 'ifg',
|
extension: 'ifg',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image extension: ifg')
|
}).to.throw('Invalid image extension: ifg')
|
||||||
})
|
})
|
||||||
@ -730,13 +659,8 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'foo.ifg.gz',
|
path: 'foo.ifg.gz',
|
||||||
extension: 'ifg',
|
extension: 'ifg',
|
||||||
archiveExtension: 'gz',
|
archiveExtension: 'gz',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image extension: ifg')
|
}).to.throw('Invalid image extension: ifg')
|
||||||
})
|
})
|
||||||
@ -747,50 +671,22 @@ describe('Model: selectionState', function () {
|
|||||||
path: 'foo.img.ifg',
|
path: 'foo.img.ifg',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
archiveExtension: 'ifg',
|
archiveExtension: 'ifg',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image archive extension: ifg')
|
}).to.throw('Invalid image archive extension: ifg')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if no size', function () {
|
|
||||||
m.chai.expect(function () {
|
|
||||||
selectionState.selectImage({
|
|
||||||
path: 'foo.img',
|
|
||||||
extension: 'img'
|
|
||||||
})
|
|
||||||
}).to.throw('Missing image fields: size')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should throw if size is not a plain object', function () {
|
|
||||||
m.chai.expect(function () {
|
|
||||||
selectionState.selectImage({
|
|
||||||
path: 'foo.img',
|
|
||||||
extension: 'img',
|
|
||||||
size: 999999999
|
|
||||||
})
|
|
||||||
}).to.throw('Invalid image size: 999999999')
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should throw if the original size is not a number', function () {
|
it('should throw if the original size is not a number', function () {
|
||||||
m.chai.expect(function () {
|
m.chai.expect(function () {
|
||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: '999999999',
|
compressedSize: '999999999',
|
||||||
final: {
|
isSizeEstimated: false
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid original image size: 999999999')
|
}).to.throw('Invalid image compressed size: 999999999')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if the original size is a float number', function () {
|
it('should throw if the original size is a float number', function () {
|
||||||
@ -798,15 +694,11 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999.999,
|
compressedSize: 999999999.999,
|
||||||
final: {
|
isSizeEstimated: false
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid original image size: 999999999.999')
|
}).to.throw('Invalid image compressed size: 999999999.999')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if the original size is negative', function () {
|
it('should throw if the original size is negative', function () {
|
||||||
@ -814,15 +706,11 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: -1,
|
compressedSize: -1,
|
||||||
final: {
|
isSizeEstimated: false
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid original image size: -1')
|
}).to.throw('Invalid image compressed size: -1')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if the final size is not a number', function () {
|
it('should throw if the final size is not a number', function () {
|
||||||
@ -830,15 +718,10 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: '999999999',
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: '999999999'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid final image size: 999999999')
|
}).to.throw('Invalid image size: 999999999')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if the final size is a float number', function () {
|
it('should throw if the final size is a float number', function () {
|
||||||
@ -846,15 +729,10 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999.999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999.999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid final image size: 999999999.999')
|
}).to.throw('Invalid image size: 999999999.999')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if the final size is negative', function () {
|
it('should throw if the final size is negative', function () {
|
||||||
@ -862,31 +740,10 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: -1,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: -1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid final image size: -1')
|
}).to.throw('Invalid image size: -1')
|
||||||
})
|
|
||||||
|
|
||||||
it('should throw if the final size estimation flag is not a boolean', function () {
|
|
||||||
m.chai.expect(function () {
|
|
||||||
selectionState.selectImage({
|
|
||||||
path: 'foo.img',
|
|
||||||
extension: 'img',
|
|
||||||
size: {
|
|
||||||
original: 999999999,
|
|
||||||
final: {
|
|
||||||
estimation: 'false',
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}).to.throw('Invalid final image size estimation flag: false')
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should throw if url is defined but it\'s not a string', function () {
|
it('should throw if url is defined but it\'s not a string', function () {
|
||||||
@ -894,13 +751,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
},
|
|
||||||
url: 1234
|
url: 1234
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image url: 1234')
|
}).to.throw('Invalid image url: 1234')
|
||||||
@ -911,13 +763,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
},
|
|
||||||
name: 1234
|
name: 1234
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image name: 1234')
|
}).to.throw('Invalid image name: 1234')
|
||||||
@ -928,13 +775,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
},
|
|
||||||
logo: 1234
|
logo: 1234
|
||||||
})
|
})
|
||||||
}).to.throw('Invalid image logo: 1234')
|
}).to.throw('Invalid image logo: 1234')
|
||||||
@ -956,13 +798,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 1234567890,
|
||||||
original: 1234567890,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1234567890
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(selectionState.hasDrive()).to.be.false
|
m.chai.expect(selectionState.hasDrive()).to.be.false
|
||||||
@ -985,13 +822,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 1500000000
|
recommendedDriveSize: 1500000000
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1028,13 +860,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: imagePath,
|
path: imagePath,
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(selectionState.hasDrive()).to.be.false
|
m.chai.expect(selectionState.hasDrive()).to.be.false
|
||||||
@ -1059,13 +886,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1177,13 +999,8 @@ describe('Model: selectionState', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'foo.img',
|
path: 'foo.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -70,13 +70,8 @@ describe('Browser: MainPage', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'rpi.img',
|
path: 'rpi.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 99999,
|
||||||
original: 99999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 99999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(controller.shouldDriveStepBeDisabled()).to.be.false
|
m.chai.expect(controller.shouldDriveStepBeDisabled()).to.be.false
|
||||||
@ -103,13 +98,8 @@ describe('Browser: MainPage', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'rpi.img',
|
path: 'rpi.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 99999,
|
||||||
original: 99999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 99999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(controller.shouldFlashStepBeDisabled()).to.be.true
|
m.chai.expect(controller.shouldFlashStepBeDisabled()).to.be.true
|
||||||
@ -157,13 +147,8 @@ describe('Browser: MainPage', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: 'rpi.img',
|
path: 'rpi.img',
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 99999,
|
||||||
original: 99999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 99999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(controller.shouldFlashStepBeDisabled()).to.be.false
|
m.chai.expect(controller.shouldFlashStepBeDisabled()).to.be.false
|
||||||
@ -197,13 +182,8 @@ describe('Browser: MainPage', function () {
|
|||||||
selectionState.selectImage({
|
selectionState.selectImage({
|
||||||
path: path.join(__dirname, 'foo', 'bar.img'),
|
path: path.join(__dirname, 'foo', 'bar.img'),
|
||||||
extension: 'img',
|
extension: 'img',
|
||||||
size: {
|
size: 999999999,
|
||||||
original: 999999999,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 999999999
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(controller.getImageBasename()).to.equal('bar.img')
|
m.chai.expect(controller.getImageBasename()).to.equal('bar.img')
|
||||||
|
@ -323,13 +323,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size - 1,
|
||||||
original: this.drive.size - 1,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: this.drive.size - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -352,13 +347,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size,
|
||||||
original: this.drive.size,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: this.drive.size
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -381,13 +371,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size + 1,
|
||||||
original: this.drive.size + 1,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: this.drive.size + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -412,13 +397,9 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size - 1,
|
||||||
original: this.drive.size - 1,
|
compressedSize: this.drive.size - 1,
|
||||||
final: {
|
isSizeEstimated: true
|
||||||
estimation: true,
|
|
||||||
value: this.drive.size - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -441,13 +422,9 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size,
|
||||||
original: this.drive.size,
|
compressedSize: this.drive.size,
|
||||||
final: {
|
isSizeEstimated: true
|
||||||
estimation: true,
|
|
||||||
value: this.drive.size
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -470,13 +447,9 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size + 1,
|
||||||
original: this.drive.size + 1,
|
compressedSize: this.drive.size + 1,
|
||||||
final: {
|
isSizeEstimated: true
|
||||||
estimation: true,
|
|
||||||
value: this.drive.size + 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -499,13 +472,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
it('should return false if the drive is undefined', function () {
|
it('should return false if the drive is undefined', function () {
|
||||||
const result = constraints.isDriveLargeEnough(undefined, {
|
const result = constraints.isDriveLargeEnough(undefined, {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: 1000000000,
|
||||||
original: 1000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(result).to.be.false
|
m.chai.expect(result).to.be.false
|
||||||
@ -574,13 +542,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
isReadOnly: false
|
isReadOnly: false
|
||||||
}, {
|
}, {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: 1000000000,
|
||||||
original: 1000000000,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1000000000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 2000000000
|
recommendedDriveSize: 2000000000
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -595,13 +558,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
isReadOnly: false
|
isReadOnly: false
|
||||||
}, {
|
}, {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: 1000000000,
|
||||||
original: 1000000000,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1000000000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 2000000000
|
recommendedDriveSize: 2000000000
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -616,13 +574,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
isReadOnly: false
|
isReadOnly: false
|
||||||
}, {
|
}, {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: 1000000000,
|
||||||
original: 1000000000,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1000000000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 2000000001
|
recommendedDriveSize: 2000000001
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -637,13 +590,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
isReadOnly: false
|
isReadOnly: false
|
||||||
}, {
|
}, {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: 1000000000,
|
||||||
original: 1000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
m.chai.expect(result).to.be.true
|
m.chai.expect(result).to.be.true
|
||||||
@ -652,13 +600,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
it('should return false if the drive is undefined', function () {
|
it('should return false if the drive is undefined', function () {
|
||||||
const result = constraints.isDriveSizeRecommended(undefined, {
|
const result = constraints.isDriveSizeRecommended(undefined, {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: 1000000000,
|
||||||
original: 1000000000,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 1000000000
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: 1000000000
|
recommendedDriveSize: 1000000000
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -715,52 +658,32 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
it('should return false if the drive is not large enough and is a source drive', function () {
|
it('should return false if the drive is not large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is not large enough and is not a source drive', function () {
|
it('should return false if the drive is not large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is a source drive', function () {
|
it('should return false if the drive is large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is not a source drive', function () {
|
it('should return false if the drive is large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -773,52 +696,32 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
it('should return false if the drive is not large enough and is a source drive', function () {
|
it('should return false if the drive is not large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is not large enough and is not a source drive', function () {
|
it('should return false if the drive is not large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is a source drive', function () {
|
it('should return false if the drive is large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is not a source drive', function () {
|
it('should return false if the drive is large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -837,52 +740,32 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
it('should return false if the drive is not large enough and is a source drive', function () {
|
it('should return false if the drive is not large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is not large enough and is not a source drive', function () {
|
it('should return false if the drive is not large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is a source drive', function () {
|
it('should return false if the drive is large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is not a source drive', function () {
|
it('should return false if the drive is large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -895,52 +778,32 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
it('should return false if the drive is not large enough and is a source drive', function () {
|
it('should return false if the drive is not large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is not large enough and is not a source drive', function () {
|
it('should return false if the drive is not large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 5000000000,
|
||||||
original: 5000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 5000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if the drive is large enough and is a source drive', function () {
|
it('should return false if the drive is large enough and is a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.join(this.mountpoint, 'rpi.img'),
|
path: path.join(this.mountpoint, 'rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.false
|
})).to.be.false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return true if the drive is large enough and is not a source drive', function () {
|
it('should return true if the drive is large enough and is not a source drive', function () {
|
||||||
m.chai.expect(constraints.isDriveValid(this.drive, {
|
m.chai.expect(constraints.isDriveValid(this.drive, {
|
||||||
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
path: path.resolve(this.mountpoint, '../bar/rpi.img'),
|
||||||
size: {
|
size: 2000000000,
|
||||||
original: 2000000000,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: 2000000000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})).to.be.true
|
})).to.be.true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -965,13 +828,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
|
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size - 1,
|
||||||
original: this.drive.size - 1,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: this.drive.size - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1015,13 +873,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
|
|
||||||
this.image = {
|
this.image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: this.drive.size - 1,
|
||||||
original: this.drive.size - 1,
|
isSizeEstimated: false
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: this.drive.size - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1302,13 +1155,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
|
|
||||||
const image = {
|
const image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: drives[2].size + 1,
|
||||||
original: drives[2].size + 1,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: drives[2].size + 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: drives[5].size + 1
|
recommendedDriveSize: drives[5].size + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1478,13 +1326,8 @@ describe('Shared: DriveConstraints', function () {
|
|||||||
|
|
||||||
const image = {
|
const image = {
|
||||||
path: path.join(__dirname, 'rpi.img'),
|
path: path.join(__dirname, 'rpi.img'),
|
||||||
size: {
|
size: drives[2].size + 1,
|
||||||
original: drives[2].size + 1,
|
isSizeEstimated: false,
|
||||||
final: {
|
|
||||||
estimation: false,
|
|
||||||
value: drives[2].size + 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
recommendedDriveSize: drives[5].size + 1
|
recommendedDriveSize: drives[5].size + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user