Update resin-lint -> @balena/lint

Change-type: patch
This commit is contained in:
Alexis Svinartchouk 2020-04-28 15:19:39 +02:00
parent ee62b9a4c7
commit 9bf58c89d4
42 changed files with 1150 additions and 1160 deletions

View File

@ -149,7 +149,7 @@ sass:
node-sass lib/gui/app/scss/main.scss > lib/gui/css/main.css
lint-ts:
resin-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts
balena-lint --fix --typescript typings lib tests scripts/clean-shrinkwrap.ts webpack.config.ts
lint-sass:
sass-lint -v lib/gui/app/scss/**/*.scss lib/gui/app/scss/*.scss

View File

@ -198,7 +198,7 @@ function prepareDrive(drive: Drive) {
// @ts-ignore
drive.progress = 0;
drive.disabled = true;
drive.on('progress', progress => {
drive.on('progress', (progress) => {
updateDriveProgress(drive, progress);
});
return drive;
@ -275,7 +275,7 @@ function updateDriveProgress(
driveScanner.on('attach', addDrive);
driveScanner.on('detach', removeDrive);
driveScanner.on('error', error => {
driveScanner.on('error', (error) => {
// Stop the drive scanning loop in case of errors,
// otherwise we risk presenting the same error over
// and over again to the user, while also heavily
@ -289,7 +289,7 @@ driveScanner.start();
let popupExists = false;
window.addEventListener('beforeunload', async event => {
window.addEventListener('beforeunload', async (event) => {
if (!flashState.isFlashing() || popupExists) {
analytics.logEvent('Close application', {
isFlashing: flashState.isFlashing(),

View File

@ -190,7 +190,7 @@ export function DriveSelectorModal({ close }: { close: () => void }) {
<div
className="list-group-item-section list-group-item-section-expanded"
tabIndex={15 + index}
onKeyPress={evt => keyboardToggleDrive(drive, evt)}
onKeyPress={(evt) => keyboardToggleDrive(drive, evt)}
>
<h6 className="list-group-item-heading">
{drive.description}

View File

@ -34,7 +34,7 @@ import {
} from '../../styled-components';
import { middleEllipsis } from '../../utils/middle-ellipsis';
const TargetDetail = styled(props => <Txt.span {...props}></Txt.span>)`
const TargetDetail = styled((props) => <Txt.span {...props}></Txt.span>)`
float: ${({ float }) => float};
`;

View File

@ -58,7 +58,7 @@ const restart = (options: any, goToMain: () => void) => {
const formattedErrors = () => {
const errors = _.map(
_.get(flashState.getFlashResults(), ['results', 'errors']),
error => {
(error) => {
return `${error.device}: ${error.message || error.code}`;
},
);

View File

@ -148,7 +148,7 @@ const URLSelector = ({ done }: { done: (imageURL: string) => void }) => {
Recent
<Card
style={{ padding: '10px 15px' }}
rows={_.map(recentImages, recent => (
rows={_.map(recentImages, (recent) => (
<Txt
key={recent}
onClick={() => {

View File

@ -82,7 +82,7 @@ export class SVGIcon extends React.Component<SVGIconProps> {
let svgData = '';
_.find(this.props.contents, content => {
_.find(this.props.contents, (content) => {
const attempt = tryParseSVGContents(content);
if (attempt) {
@ -94,7 +94,7 @@ export class SVGIcon extends React.Component<SVGIconProps> {
});
if (!svgData) {
_.find(this.props.paths, relativePath => {
_.find(this.props.paths, (relativePath) => {
// This means the path to the icon should be
// relative to *this directory*.
// TODO: There might be a way to compute the path

View File

@ -100,10 +100,7 @@ export function getFlashResults() {
}
export function getFlashState() {
return store
.getState()
.get('flashState')
.toJS();
return store.getState().get('flashState').toJS();
}
export function wasLastFlashCancelled() {

View File

@ -81,7 +81,7 @@ export function init() {
for (const [drivePath, ledsNames] of Object.entries(ledsMapping)) {
leds.set('/dev/disk/by-path/' + drivePath, new RGBLed(ledsNames));
}
observe(state => {
observe((state) => {
const availableDrives = state
.get('availableDrives')
.toJS()

View File

@ -51,10 +51,7 @@ export function selectImage(image: any) {
* @summary Get all selected drives' devices
*/
export function getSelectedDevices(): string[] {
return store
.getState()
.getIn(['selection', 'devices'])
.toJS();
return store.getState().getIn(['selection', 'devices']).toJS();
}
/**
@ -62,7 +59,7 @@ export function getSelectedDevices(): string[] {
*/
export function getSelectedDrives(): any[] {
const drives = availableDrives.getDrives();
return _.map(getSelectedDevices(), device => {
return _.map(getSelectedDevices(), (device) => {
return _.find(drives, { device });
});
}

View File

@ -34,7 +34,7 @@ function verifyNoNilFields(
fields: string[],
name: string,
) {
const nilFields = _.filter(fields, field => {
const nilFields = _.filter(fields, (field) => {
return _.isNil(_.get(object, field));
});
if (nilFields.length) {
@ -133,9 +133,9 @@ function storeReducer(
drives = _.sortBy(drives, [
// Devices with no devicePath first (usbboot)
d => !!d.devicePath,
(d) => !!d.devicePath,
// Then sort by devicePath (only available on Linux with udev) or device
d => d.devicePath || d.device,
(d) => d.devicePath || d.device,
]);
const newState = state.set('availableDrives', Immutable.fromJS(drives));

View File

@ -149,13 +149,13 @@ export function performWrite(
let cancelled = false;
ipc.serve();
return new Promise((resolve, reject) => {
ipc.server.on('error', error => {
ipc.server.on('error', (error) => {
terminateServer();
const errorObject = errors.fromJSON(error);
reject(errorObject);
});
ipc.server.on('log', message => {
ipc.server.on('log', (message) => {
console.log(message);
});
@ -174,8 +174,8 @@ export function performWrite(
handleErrorLogging(error, analyticsData);
});
ipc.server.on('done', event => {
event.results.errors = _.map(event.results.errors, data => {
ipc.server.on('done', (event) => {
event.results.errors = _.map(event.results.errors, (data) => {
return errors.fromJSON(data);
});
_.merge(flashResults, event);

View File

@ -147,7 +147,7 @@ class UpdateLock extends EventEmitter {
logException(checkError);
}
if (!isLocked) {
UpdateLock.acquire(error => {
UpdateLock.acquire((error) => {
if (error) {
logException(error);
}

View File

@ -88,7 +88,7 @@ async function getWindowsNetworkDrives(): Promise<Map<string, string>> {
trim(str.slice(colonPosition + 1)),
];
})
.filter(couple => couple[1].length > 0)
.filter((couple) => couple[1].length > 0)
.value();
return new Map(couples);
}

View File

@ -31,7 +31,7 @@ const StepBorder = styled.div<{
right?: boolean;
}>`
height: 2px;
background-color: ${props =>
background-color: ${(props) =>
props.disabled
? props.theme.customColors.dark.disabled.foreground
: props.theme.customColors.dark.foreground};
@ -39,8 +39,8 @@ const StepBorder = styled.div<{
width: 124px;
top: 19px;
left: ${props => (props.left ? '-67px' : undefined)};
right: ${props => (props.right ? '-67px' : undefined)};
left: ${(props) => (props.left ? '-67px' : undefined)};
right: ${(props) => (props.right ? '-67px' : undefined)};
`;
const getDriveListLabel = () => {

View File

@ -61,7 +61,7 @@ export const BaseButton = styled(Button)`
height: 48px;
`;
export const IconButton = styled(props => <Button plain {...props} />)`
export const IconButton = styled((props) => <Button plain {...props} />)`
&&& {
width: 24px;
height: 24px;

View File

@ -100,7 +100,7 @@ function createMainWindow() {
// Prevent external resources from being loaded (like images)
// when dropping them on the WebView.
// See https://github.com/electron/electron/issues/5919
mainWindow.webContents.on('will-navigate', event => {
mainWindow.webContents.on('will-navigate', (event) => {
event.preventDefault();
});
@ -111,7 +111,7 @@ function createMainWindow() {
const page = mainWindow.webContents;
page.once('did-frame-finish-load', async () => {
autoUpdater.on('error', err => {
autoUpdater.on('error', (err) => {
analytics.logException(err);
});
if (packageUpdatable) {

View File

@ -231,7 +231,7 @@ ipc.connectTo(IPC_SERVER_ID, () => {
log(`Validate on success: ${options.validateWriteOnSuccess}`);
log(`Auto blockmapping: ${options.autoBlockmapping}`);
log(`Decompress first: ${options.decompressFirst}`);
const dests = _.map(options.destinations, destination => {
const dests = _.map(options.destinations, (destination) => {
return new sdk.sourceDestination.BlockDevice({
drive: destination,
unmountOnSuccess: options.unmountOnSuccess,
@ -259,7 +259,7 @@ ipc.connectTo(IPC_SERVER_ID, () => {
onFail,
});
log(`Finish: ${results.bytesWritten}`);
results.errors = _.map(results.errors, error => {
results.errors = _.map(results.errors, (error) => {
return toJSON(error);
});
ipc.of[IPC_SERVER_ID].emit('done', { results });

View File

@ -67,7 +67,7 @@ export function isSourceDrive(drive: DrivelistDrive, image: Image): boolean {
}
return _.some(
_.map(mountpoints, mountpoint => {
_.map(mountpoints, (mountpoint) => {
return pathIsInside(imagePath, mountpoint.path);
}),
);
@ -235,7 +235,7 @@ export function getListDriveImageCompatibilityStatuses(
drives: DrivelistDrive[],
image: Image,
) {
return _.flatMap(drives, drive => {
return _.flatMap(drives, (drive) => {
return getDriveImageCompatibilityStatuses(drive, image);
});
}

View File

@ -24,7 +24,7 @@ function createErrorDetails(options: {
description: (error: Error) => string;
} {
return _.pick(
_.mapValues(options, value => {
_.mapValues(options, (value) => {
return _.isFunction(value) ? value : _.constant(value);
}),
['title', 'description'],

View File

@ -26,11 +26,7 @@ import { lookup } from 'mime-types';
* > [ 'img', 'gz' ]
*/
export function getFileExtensions(filePath: string): string[] {
return _.chain(filePath)
.split('.')
.tail()
.map(_.toLower)
.value();
return _.chain(filePath).split('.').tail().map(_.toLower).value();
}
/**

View File

@ -41,7 +41,7 @@ export function percentageToFloat(percentage: any) {
* @summary Check if obj has one or many specific props
*/
export function hasProps(obj: any, props: string[]): boolean {
return _.every(props, prop => {
return _.every(props, (prop) => {
return _.has(obj, prop);
});
}

748
npm-shrinkwrap.json generated
View File

@ -78,6 +78,12 @@
"@babel/types": "^7.7.0"
}
},
"@babel/helper-validator-identifier": {
"version": "7.9.5",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz",
"integrity": "sha512-/8arLKUFq882w4tWGj9JYzRpAlZgiWUJ+dtteNTDqrRBz9Iguck9Rn3ykuBDoUwh2TO4tSAJlrxDUOXWklJe4g==",
"dev": true
},
"@babel/highlight": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
@ -208,6 +214,59 @@
}
}
},
"@balena/lint": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/@balena/lint/-/lint-5.0.4.tgz",
"integrity": "sha512-RRk/DtvV52pew+wN7/DR34Pskaq7mVTcqH5fgXO6lXlAT/l6ZjwaIftVFDuXotYthfy0VdN+Wlx+gye/LYEJlA==",
"dev": true,
"requires": {
"@types/glob": "^7.1.1",
"@types/lodash": "^4.14.149",
"@types/node": "^10.17.19",
"@types/optimist": "0.0.29",
"@types/prettier": "^2.0.0",
"coffee-script": "^1.10.0",
"coffeelint": "^1.15.0",
"coffeescope2": "^0.4.5",
"depcheck": "^0.9.2",
"glob": "^7.1.6",
"lodash": "^4.17.15",
"optimist": "^0.6.1",
"prettier": "^2.0.4",
"tslint": "^6.1.1",
"tslint-config-prettier": "^1.18.0",
"tslint-no-unused-expression-chai": "^0.1.4",
"typescript": "^3.8.3"
},
"dependencies": {
"@types/node": {
"version": "10.17.21",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.21.tgz",
"integrity": "sha512-PQKsydPxYxF1DsAFWmunaxd3sOi3iMt6Zmx/tgaagHYmwJ/9cRH91hQkeJZaUGWbvn0K5HlSVEXkn5U/llWPpQ==",
"dev": true
},
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"typescript": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==",
"dev": true
}
}
},
"@braintree/sanitize-url": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-3.1.0.tgz",
@ -478,12 +537,6 @@
"integrity": "sha512-Q1y515GcOdTHgagaVFhHnIFQ38ygs/kmxdNpvpou+raI9UO3YZcHDngBSYKQklcKlvA7iuQlmIKbzvmxcOE9CQ==",
"dev": true
},
"@types/depcheck": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/@types/depcheck/-/depcheck-0.6.0.tgz",
"integrity": "sha512-l/1wJTM4G+aWVzonZJ8vx/xJp3flBLWgZMUrCWBaGysiCutl+q3Eu1lKPq6GYFasP7L19KZ3L/y1kv3X08R71w==",
"dev": true
},
"@types/domhandler": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/@types/domhandler/-/domhandler-2.4.1.tgz",
@ -504,9 +557,9 @@
"dev": true
},
"@types/glob": {
"version": "5.0.36",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-5.0.36.tgz",
"integrity": "sha512-KEzSKuP2+3oOjYYjujue6Z3Yqis5HKA1BsIC+jZ1v3lrRNdsqyNNtX0rQf6LSuI4DJJ2z5UV//zBZCcvM0xikg==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.1.tgz",
"integrity": "sha512-1Bh06cbWJUHMC97acuD6UMG29nMt0Aqz1vF3guLfG+kHHJhy3AyohZFFxYk2f7Q1SQIrNwvncxAE0N/9s70F2w==",
"dev": true,
"requires": {
"@types/events": "*",
@ -584,9 +637,9 @@
"dev": true
},
"@types/prettier": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-1.19.0.tgz",
"integrity": "sha512-gDE8JJEygpay7IjA/u3JiIURvwZW08f0cZSZLAzFoX/ZmeqvS0Sqv+97aKuHpNsalAMMhwPe+iAS6fQbfmbt7A==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.0.0.tgz",
"integrity": "sha512-/rM+sWiuOZ5dvuVzV37sUuklsbg+JPOP8d+nNFlo2ZtfpzPiPvh1/gc8liWOLBqe+sR+ZM7guPaIcTt6UZTo7Q==",
"dev": true
},
"@types/prop-types": {
@ -1607,34 +1660,6 @@
"follow-redirects": "1.5.10"
}
},
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
"integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=",
"dev": true,
"requires": {
"chalk": "^1.1.3",
"esutils": "^2.0.2",
"js-tokens": "^3.0.2"
},
"dependencies": {
"js-tokens": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=",
"dev": true
}
}
},
"babel-messages": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz",
"integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=",
"dev": true,
"requires": {
"babel-runtime": "^6.22.0"
}
},
"babel-plugin-styled-components": {
"version": "1.10.6",
"resolved": "https://registry.npmjs.org/babel-plugin-styled-components/-/babel-plugin-styled-components-1.10.6.tgz",
@ -1675,72 +1700,6 @@
}
}
},
"babel-traverse": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz",
"integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=",
"dev": true,
"requires": {
"babel-code-frame": "^6.26.0",
"babel-messages": "^6.23.0",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"babylon": "^6.18.0",
"debug": "^2.6.8",
"globals": "^9.18.0",
"invariant": "^2.2.2",
"lodash": "^4.17.4"
},
"dependencies": {
"debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
},
"globals": {
"version": "9.18.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
"integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==",
"dev": true
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=",
"dev": true
}
}
},
"babel-types": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz",
"integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=",
"dev": true,
"requires": {
"babel-runtime": "^6.26.0",
"esutils": "^2.0.2",
"lodash": "^4.17.4",
"to-fast-properties": "^1.0.3"
},
"dependencies": {
"to-fast-properties": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
"integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=",
"dev": true
}
}
},
"babylon": {
"version": "6.18.0",
"resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz",
"integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==",
"dev": true
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -2242,9 +2201,9 @@
}
},
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz",
"integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==",
"dev": true
},
"builtin-status-codes": {
@ -3593,6 +3552,12 @@
"integrity": "sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==",
"dev": true
},
"de-indent": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
"integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=",
"dev": true
},
"debug": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
@ -3761,263 +3726,329 @@
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
},
"depcheck": {
"version": "0.6.11",
"resolved": "https://registry.npmjs.org/depcheck/-/depcheck-0.6.11.tgz",
"integrity": "sha512-wTVJ8cNilB8NfkzoBblcYqsB8LRfbjqKEwAOLD3YXIRigktSM7/lS9xQfVkAVujhjstmiQMZR0hkdHSnQxzb9A==",
"version": "0.9.2",
"resolved": "https://registry.npmjs.org/depcheck/-/depcheck-0.9.2.tgz",
"integrity": "sha512-w5f+lSZqLJJkk58s44eOd0Vor7hLZot4PlFL0y2JsIX5LuHQ2eAjHlDVeGBD4Mj6ZQSKakvKWRRCcPlvrdU2Sg==",
"dev": true,
"requires": {
"babel-traverse": "^6.7.3",
"babylon": "^6.1.21",
"builtin-modules": "^1.1.1",
"deprecate": "^1.0.0",
"@babel/parser": "^7.7.7",
"@babel/traverse": "^7.7.4",
"builtin-modules": "^3.0.0",
"camelcase": "^5.3.1",
"cosmiconfig": "^5.2.1",
"debug": "^4.1.1",
"deps-regex": "^0.1.4",
"js-yaml": "^3.4.2",
"lodash": "^4.5.1",
"lodash": "^4.17.15",
"minimatch": "^3.0.2",
"node-sass-tilde-importer": "^1.0.2",
"please-upgrade-node": "^3.2.0",
"require-package-name": "^2.0.1",
"walkdir": "0.0.11",
"yargs": "^8.0.2"
"resolve": "^1.14.1",
"vue-template-compiler": "^2.6.11",
"walkdir": "^0.4.1",
"yargs": "^15.0.2"
},
"dependencies": {
"@babel/code-frame": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.8.3.tgz",
"integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==",
"dev": true,
"requires": {
"@babel/highlight": "^7.8.3"
}
},
"@babel/generator": {
"version": "7.9.5",
"resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.9.5.tgz",
"integrity": "sha512-GbNIxVB3ZJe3tLeDm1HSn2AhuD/mVcyLDpgtLXa5tplmWrJdF/elxB56XNqCuD6szyNkDi6wuoKXln3QeBmCHQ==",
"dev": true,
"requires": {
"@babel/types": "^7.9.5",
"jsesc": "^2.5.1",
"lodash": "^4.17.13",
"source-map": "^0.5.0"
}
},
"@babel/helper-function-name": {
"version": "7.9.5",
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.9.5.tgz",
"integrity": "sha512-JVcQZeXM59Cd1qanDUxv9fgJpt3NeKUaqBqUEvfmQ+BCOKq2xUgaWZW2hr0dkbyJgezYuplEoh5knmrnS68efw==",
"dev": true,
"requires": {
"@babel/helper-get-function-arity": "^7.8.3",
"@babel/template": "^7.8.3",
"@babel/types": "^7.9.5"
}
},
"@babel/helper-get-function-arity": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz",
"integrity": "sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA==",
"dev": true,
"requires": {
"@babel/types": "^7.8.3"
}
},
"@babel/helper-split-export-declaration": {
"version": "7.8.3",
"resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz",
"integrity": "sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA==",
"dev": true,
"requires": {
"@babel/types": "^7.8.3"
}
},
"@babel/highlight": {
"version": "7.9.0",
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.9.0.tgz",
"integrity": "sha512-lJZPilxX7Op3Nv/2cvFdnlepPXDxi29wxteT57Q965oc5R9v86ztx0jfxVrTcBk8C2kcPkkDa2Z4T3ZsPPVWsQ==",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.9.0",
"chalk": "^2.0.0",
"js-tokens": "^4.0.0"
}
},
"@babel/parser": {
"version": "7.9.4",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.9.4.tgz",
"integrity": "sha512-bC49otXX6N0/VYhgOMh4gnP26E9xnDZK3TmbNpxYzzz9BQLBosQwfyOe9/cXUU3txYhTzLCbcqd5c8y/OmCjHA==",
"dev": true
},
"@babel/template": {
"version": "7.8.6",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.8.6.tgz",
"integrity": "sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/parser": "^7.8.6",
"@babel/types": "^7.8.6"
}
},
"@babel/traverse": {
"version": "7.9.5",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.9.5.tgz",
"integrity": "sha512-c4gH3jsvSuGUezlP6rzSJ6jf8fYjLj3hsMZRx/nX0h+fmHN0w+ekubRrHPqnMec0meycA2nwCsJ7dC8IPem2FQ==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.8.3",
"@babel/generator": "^7.9.5",
"@babel/helper-function-name": "^7.9.5",
"@babel/helper-split-export-declaration": "^7.8.3",
"@babel/parser": "^7.9.0",
"@babel/types": "^7.9.5",
"debug": "^4.1.0",
"globals": "^11.1.0",
"lodash": "^4.17.13"
}
},
"@babel/types": {
"version": "7.9.5",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.9.5.tgz",
"integrity": "sha512-XjnvNqenk818r5zMaba+sLQjnbda31UfUURv3ei0qPQw4u+j2jMyJ5b11y8ZHYTRSI3NnInQkkkRT4fLqqPdHg==",
"dev": true,
"requires": {
"@babel/helper-validator-identifier": "^7.9.5",
"lodash": "^4.17.13",
"to-fast-properties": "^2.0.0"
}
},
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
},
"camelcase": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz",
"integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=",
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"dev": true
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
}
},
"cliui": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz",
"integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=",
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"dev": true,
"requires": {
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1",
"wrap-ansi": "^2.0.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"dev": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
}
}
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^6.2.0"
}
},
"find-up": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz",
"integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=",
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"locate-path": "^2.0.0"
"color-name": "~1.1.4"
}
},
"get-caller-file": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz",
"integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==",
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"load-json-file": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"parse-json": "^2.2.0",
"pify": "^2.0.0",
"strip-bom": "^3.0.0"
"ms": "^2.1.1"
}
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"dev": true,
"requires": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
}
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"locate-path": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz",
"integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=",
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"dev": true,
"requires": {
"p-locate": "^2.0.0",
"path-exists": "^3.0.0"
}
},
"p-limit": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz",
"integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==",
"dev": true,
"requires": {
"p-try": "^1.0.0"
"p-locate": "^4.1.0"
}
},
"p-locate": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz",
"integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=",
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"dev": true,
"requires": {
"p-limit": "^1.1.0"
"p-limit": "^2.2.0"
}
},
"p-try": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz",
"integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=",
"dev": true
},
"path-exists": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
"integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true
},
"path-type": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
"integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
"resolve": {
"version": "1.17.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz",
"integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==",
"dev": true,
"requires": {
"pify": "^2.0.0"
"path-parse": "^1.0.6"
}
},
"read-pkg": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
"integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
"dev": true,
"requires": {
"load-json-file": "^2.0.0",
"normalize-package-data": "^2.3.2",
"path-type": "^2.0.0"
}
},
"read-pkg-up": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
"integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
"dev": true,
"requires": {
"find-up": "^2.0.0",
"read-pkg": "^2.0.0"
}
},
"require-main-filename": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz",
"integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=",
"source-map": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz",
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
"string-width": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
"integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
"integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
"dev": true,
"requires": {
"is-fullwidth-code-point": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"dependencies": {
"is-fullwidth-code-point": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
"dev": true
},
"strip-ansi": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "^3.0.0"
}
}
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"dev": true
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.0"
}
},
"wrap-ansi": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"dev": true,
"requires": {
"string-width": "^1.0.1",
"strip-ansi": "^3.0.1"
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"dependencies": {
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
"integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=",
"ansi-styles": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"dev": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
"strip-ansi": "^3.0.0"
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
}
}
},
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
"integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=",
"dev": true
},
"yargs": {
"version": "8.0.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz",
"integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=",
"version": "15.3.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.3.1.tgz",
"integrity": "sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA==",
"dev": true,
"requires": {
"camelcase": "^4.1.0",
"cliui": "^3.2.0",
"decamelize": "^1.1.1",
"get-caller-file": "^1.0.1",
"os-locale": "^2.0.0",
"read-pkg-up": "^2.0.0",
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^1.0.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^3.2.1",
"yargs-parser": "^7.0.0"
"y18n": "^4.0.0",
"yargs-parser": "^18.1.1"
}
},
"yargs-parser": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz",
"integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=",
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"dev": true,
"requires": {
"camelcase": "^4.1.0"
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"deprecate": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/deprecate/-/deprecate-1.1.1.tgz",
"integrity": "sha512-ZGDXefq1xknT292LnorMY5s8UVU08/WKdzDZCUT6t9JzsiMSP4uzUhgpqugffNVcT5WC6wMBiSQ+LFjlv3v7iQ==",
"dev": true
},
"deps-regex": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/deps-regex/-/deps-regex-0.1.4.tgz",
@ -5889,6 +5920,12 @@
"pkg-dir": "^3.0.0"
}
},
"find-parent-dir": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz",
"integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=",
"dev": true
},
"find-up": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
@ -7268,15 +7305,6 @@
"integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==",
"dev": true
},
"invariant": {
"version": "2.2.4",
"resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz",
"integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==",
"dev": true,
"requires": {
"loose-envify": "^1.0.0"
}
},
"invert-kv": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz",
@ -9542,6 +9570,15 @@
}
}
},
"node-sass-tilde-importer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/node-sass-tilde-importer/-/node-sass-tilde-importer-1.0.2.tgz",
"integrity": "sha512-Swcmr38Y7uB78itQeBm3mThjxBy9/Ah/ykPIaURY/L6Nec9AyRoL/jJ7ECfMR+oZeCTVQNxVMu/aHU+TLRVbdg==",
"dev": true,
"requires": {
"find-parent-dir": "^0.3.0"
}
},
"noop-logger": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz",
@ -10313,9 +10350,9 @@
"dev": true
},
"prettier": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz",
"integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==",
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz",
"integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==",
"dev": true
},
"pretty-bytes": {
@ -11130,74 +11167,6 @@
"replacestream": "^4.0.0"
}
},
"resin-lint": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/resin-lint/-/resin-lint-3.2.0.tgz",
"integrity": "sha512-pVP/RJXqXpLeY1ZULok0VL02KqP6QEyGVa0wclJpjcmOC4yhYXkWk71k72Jhs+6WKq3Xgw6RjJoy7MhZ5Hjn8A==",
"dev": true,
"requires": {
"@types/bluebird": "^3.5.29",
"@types/depcheck": "^0.6.0",
"@types/glob": "^5.0.35",
"@types/lodash": "^4.14.149",
"@types/node": "^8.10.59",
"@types/optimist": "0.0.29",
"@types/prettier": "^1.18.3",
"bluebird": "^3.7.2",
"coffee-script": "^1.10.0",
"coffeelint": "^1.15.0",
"coffeescope2": "^0.4.5",
"depcheck": "^0.6.7",
"glob": "^7.1.6",
"lodash": "^4.17.15",
"optimist": "^0.6.1",
"prettier": "^1.19.1",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-no-unused-expression-chai": "^0.1.4",
"typescript": "^3.7.5"
},
"dependencies": {
"@types/lodash": {
"version": "4.14.149",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.149.tgz",
"integrity": "sha512-ijGqzZt/b7BfzcK9vTrS6MFljQRPn5BFWOx8oE0GYxribu6uV+aA9zZuXI1zc/etK9E8nrgdoF2+LgUw7+9tJQ==",
"dev": true
},
"@types/node": {
"version": "8.10.59",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.59.tgz",
"integrity": "sha512-8RkBivJrDCyPpBXhVZcjh7cQxVBSmRk9QM7hOketZzp6Tg79c0N8kkpAIito9bnJ3HCVCHVYz+KHTEbfQNfeVQ==",
"dev": true
},
"bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
"dev": true
},
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"typescript": {
"version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"dev": true
}
}
},
"resolve": {
"version": "1.12.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz",
@ -13114,9 +13083,9 @@
"integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ=="
},
"tslint": {
"version": "5.20.1",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.1.tgz",
"integrity": "sha512-EcMxhzCFt8k+/UP5r8waCf/lzmeSyVlqxqMEDQE7rWYiQky8KpIBz1JAoYXfROHrPZ1XXd43q8yQnULOLiBRQg==",
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.2.tgz",
"integrity": "sha512-UyNrLdK3E0fQG/xWNqAFAC5ugtFyPO4JJR1KyyfQAyzR8W0fTRrC91A8Wej4BntFzcvETdCSDa/4PnNYJQLYiA==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.0.0",
@ -13127,13 +13096,19 @@
"glob": "^7.1.1",
"js-yaml": "^3.13.1",
"minimatch": "^3.0.4",
"mkdirp": "^0.5.1",
"mkdirp": "^0.5.3",
"resolve": "^1.3.2",
"semver": "^5.3.0",
"tslib": "^1.8.0",
"tslib": "^1.10.0",
"tsutils": "^2.29.0"
},
"dependencies": {
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
"integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=",
"dev": true
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
@ -13150,6 +13125,21 @@
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true
},
"minimist": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
"dev": true
},
"mkdirp": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
"integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
"dev": true,
"requires": {
"minimist": "^1.2.5"
}
}
}
},
@ -13567,10 +13557,20 @@
"integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==",
"dev": true
},
"vue-template-compiler": {
"version": "2.6.11",
"resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.6.11.tgz",
"integrity": "sha512-KIq15bvQDrcCjpGjrAhx4mUlyyHfdmTaoNfeoATHLAiWB+MU3cx4lOzMwrnUh9cCxy0Lt1T11hAFY6TQgroUAA==",
"dev": true,
"requires": {
"de-indent": "^1.0.2",
"he": "^1.1.0"
}
},
"walkdir": {
"version": "0.0.11",
"resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.0.11.tgz",
"integrity": "sha1-oW0CXrkxvQO1LzCMrtD0D86+lTI=",
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/walkdir/-/walkdir-0.4.1.tgz",
"integrity": "sha512-3eBwRyEln6E1MSzcxcVpQIhRG8Q1jLvEqRmCZqS3dsfXEDR/AhOF4d+jHg1qvDCpYaVRZjENPQyrVxAkQqxPgQ==",
"dev": true
},
"watchpack": {

View File

@ -86,6 +86,7 @@
"uuid": "^3.0.1"
},
"devDependencies": {
"@balena/lint": "^5.0.4",
"@types/bindings": "^1.3.0",
"@types/bluebird": "^3.5.30",
"@types/chai": "^4.2.7",
@ -112,7 +113,6 @@
"node-gyp": "^3.8.0",
"node-sass": "^4.12.0",
"omit-deep-lodash": "1.1.4",
"resin-lint": "^3.2.0",
"sass-lint": "^1.12.1",
"simple-progress-webpack-plugin": "^1.1.2",
"sinon": "^8.0.4",

View File

@ -21,44 +21,44 @@ import * as availableDrives from '../../../lib/gui/app/models/available-drives';
import * as selectionState from '../../../lib/gui/app/models/selection-state';
import * as constraints from '../../../lib/shared/drive-constraints';
describe('Model: availableDrives', function() {
describe('availableDrives', function() {
it('should have no drives by default', function() {
describe('Model: availableDrives', function () {
describe('availableDrives', function () {
it('should have no drives by default', function () {
expect(availableDrives.getDrives()).to.deep.equal([]);
});
describe('.setDrives()', function() {
it('should throw if no drives', function() {
expect(function() {
describe('.setDrives()', function () {
it('should throw if no drives', function () {
expect(function () {
// @ts-ignore
availableDrives.setDrives();
}).to.throw('Missing drives');
});
it('should throw if drives is not an array', function() {
expect(function() {
it('should throw if drives is not an array', function () {
expect(function () {
// @ts-ignore
availableDrives.setDrives(123);
}).to.throw('Invalid drives: 123');
});
it('should throw if drives is not an array of objects', function() {
expect(function() {
it('should throw if drives is not an array of objects', function () {
expect(function () {
// @ts-ignore
availableDrives.setDrives([123, 123, 123]);
}).to.throw('Invalid drives: 123,123,123');
});
});
describe('given no drives', function() {
describe('.hasAvailableDrives()', function() {
it('should return false', function() {
describe('given no drives', function () {
describe('.hasAvailableDrives()', function () {
it('should return false', function () {
expect(availableDrives.hasAvailableDrives()).to.be.false;
});
});
describe('.setDrives()', function() {
it('should be able to set drives', function() {
describe('.setDrives()', function () {
it('should be able to set drives', function () {
const drives = [
{
device: '/dev/sdb',
@ -77,7 +77,7 @@ describe('Model: availableDrives', function() {
expect(availableDrives.getDrives()).to.deep.equal(drives);
});
it('should be able to set drives with extra properties', function() {
it('should be able to set drives with extra properties', function () {
const drives = [
{
device: '/dev/sdb',
@ -101,7 +101,7 @@ describe('Model: availableDrives', function() {
expect(availableDrives.getDrives()).to.deep.equal(drives);
});
it('should be able to set drives with null sizes', function() {
it('should be able to set drives with null sizes', function () {
const drives = [
{
device: '/dev/sdb',
@ -120,12 +120,12 @@ describe('Model: availableDrives', function() {
expect(availableDrives.getDrives()).to.deep.equal(drives);
});
describe('given no selected image and no selected drive', function() {
beforeEach(function() {
describe('given no selected image and no selected drive', function () {
beforeEach(function () {
selectionState.clear();
});
it('should auto-select a single valid available drive', function() {
it('should auto-select a single valid available drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -148,8 +148,8 @@ describe('Model: availableDrives', function() {
});
});
describe('given a selected image and no selected drive', function() {
beforeEach(function() {
describe('given a selected image and no selected drive', function () {
beforeEach(function () {
if (process.platform === 'win32') {
this.imagePath = 'E:\\bar\\foo.img';
} else {
@ -166,11 +166,11 @@ describe('Model: availableDrives', function() {
});
});
afterEach(function() {
afterEach(function () {
selectionState.deselectImage();
});
it('should not auto-select when there are multiple valid available drives', function() {
it('should not auto-select when there are multiple valid available drives', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -203,7 +203,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.hasDrive()).to.be.false;
});
it('should auto-select a single valid available drive', function() {
it('should auto-select a single valid available drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -224,7 +224,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.getSelectedDevices()[0]).to.equal('/dev/sdb');
});
it('should not auto-select a single too small drive', function() {
it('should not auto-select a single too small drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -245,7 +245,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.hasDrive()).to.be.false;
});
it("should not auto-select a single drive that doesn't meet the recommended size", function() {
it("should not auto-select a single drive that doesn't meet the recommended size", function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -266,7 +266,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.hasDrive()).to.be.false;
});
it('should not auto-select a single protected drive', function() {
it('should not auto-select a single protected drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -287,7 +287,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.hasDrive()).to.be.false;
});
it('should not auto-select a source drive', function() {
it('should not auto-select a source drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -308,7 +308,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.hasDrive()).to.be.false;
});
it('should not auto-select a single system drive', function() {
it('should not auto-select a single system drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -329,7 +329,7 @@ describe('Model: availableDrives', function() {
expect(selectionState.hasDrive()).to.be.false;
});
it('should not auto-select a single large size drive', function() {
it('should not auto-select a single large size drive', function () {
expect(selectionState.hasDrive()).to.be.false;
availableDrives.setDrives([
@ -353,8 +353,8 @@ describe('Model: availableDrives', function() {
});
});
describe('given drives', function() {
beforeEach(function() {
describe('given drives', function () {
beforeEach(function () {
this.drives = [
{
device: '/dev/sdb',
@ -385,8 +385,8 @@ describe('Model: availableDrives', function() {
availableDrives.setDrives(this.drives);
});
describe('given one of the drives was selected', function() {
beforeEach(function() {
describe('given one of the drives was selected', function () {
beforeEach(function () {
availableDrives.setDrives([
{
device: '/dev/sdc',
@ -405,11 +405,11 @@ describe('Model: availableDrives', function() {
selectionState.selectDrive('/dev/sdc');
});
afterEach(function() {
afterEach(function () {
selectionState.clear();
});
it('should be deleted if its not contained in the available drives anymore', function() {
it('should be deleted if its not contained in the available drives anymore', function () {
expect(selectionState.hasDrive()).to.be.true;
// We have to provide at least two drives, otherwise,
@ -446,25 +446,25 @@ describe('Model: availableDrives', function() {
});
});
describe('.hasAvailableDrives()', function() {
it('should return true', function() {
describe('.hasAvailableDrives()', function () {
it('should return true', function () {
const hasDrives = availableDrives.hasAvailableDrives();
expect(hasDrives).to.be.true;
});
});
describe('.setDrives()', function() {
it('should keep the same drives if equal', function() {
describe('.setDrives()', function () {
it('should keep the same drives if equal', function () {
availableDrives.setDrives(this.drives);
expect(availableDrives.getDrives()).to.deep.equal(this.drives);
});
it('should return empty array given an empty array', function() {
it('should return empty array given an empty array', function () {
availableDrives.setDrives([]);
expect(availableDrives.getDrives()).to.deep.equal([]);
});
it('should consider drives with different $$hashKey the same', function() {
it('should consider drives with different $$hashKey the same', function () {
this.drives[0].$$haskey = 1234;
availableDrives.setDrives(this.drives);
expect(availableDrives.getDrives()).to.deep.equal(this.drives);

View File

@ -18,14 +18,14 @@ import { expect } from 'chai';
import * as flashState from '../../../lib/gui/app/models/flash-state';
describe('Model: flashState', function() {
beforeEach(function() {
describe('Model: flashState', function () {
beforeEach(function () {
flashState.resetState();
});
describe('flashState', function() {
describe('.resetState()', function() {
it('should be able to reset the progress state', function() {
describe('flashState', function () {
describe('.resetState()', function () {
it('should be able to reset the progress state', function () {
flashState.setFlashingFlag();
flashState.setProgressState({
failed: 0,
@ -50,7 +50,7 @@ describe('Model: flashState', function() {
});
});
it('should be able to reset the progress state', function() {
it('should be able to reset the progress state', function () {
flashState.unsetFlashingFlag({
cancelled: false,
sourceChecksum: '1234',
@ -60,38 +60,38 @@ describe('Model: flashState', function() {
expect(flashState.getFlashResults()).to.deep.equal({});
});
it('should unset the flashing flag', function() {
it('should unset the flashing flag', function () {
flashState.setFlashingFlag();
flashState.resetState();
expect(flashState.isFlashing()).to.be.false;
});
it('should unset the flash uuid', function() {
it('should unset the flash uuid', function () {
flashState.setFlashingFlag();
flashState.resetState();
expect(flashState.getFlashUuid()).to.be.undefined;
});
});
describe('.isFlashing()', function() {
it('should return false by default', function() {
describe('.isFlashing()', function () {
it('should return false by default', function () {
expect(flashState.isFlashing()).to.be.false;
});
it('should return true if flashing', function() {
it('should return true if flashing', function () {
flashState.setFlashingFlag();
expect(flashState.isFlashing()).to.be.true;
});
});
describe('.setProgressState()', function() {
it('should not allow setting the state if flashing is false', function() {
describe('.setProgressState()', function () {
it('should not allow setting the state if flashing is false', function () {
flashState.unsetFlashingFlag({
cancelled: false,
sourceChecksum: '1234',
});
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -106,9 +106,9 @@ describe('Model: flashState', function() {
}).to.throw("Can't set the flashing state when not flashing");
});
it('should not throw if percentage is 0', function() {
it('should not throw if percentage is 0', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -123,9 +123,9 @@ describe('Model: flashState', function() {
}).to.not.throw('Missing flash fields: percentage');
});
it('should throw if percentage is outside maximum bound', function() {
it('should throw if percentage is outside maximum bound', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -140,9 +140,9 @@ describe('Model: flashState', function() {
}).to.throw('Invalid state percentage: 101');
});
it('should throw if percentage is outside minimum bound', function() {
it('should throw if percentage is outside minimum bound', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -157,9 +157,9 @@ describe('Model: flashState', function() {
}).to.throw('Invalid state percentage: -1');
});
it('should not throw if eta is equal to zero', function() {
it('should not throw if eta is equal to zero', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -174,9 +174,9 @@ describe('Model: flashState', function() {
}).to.not.throw('Missing flash field eta');
});
it('should throw if eta is not a number', function() {
it('should throw if eta is not a number', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -192,9 +192,9 @@ describe('Model: flashState', function() {
}).to.throw('Invalid state eta: 15');
});
it('should throw if speed is missing', function() {
it('should throw if speed is missing', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
// @ts-ignore
flashState.setProgressState({
failed: 0,
@ -209,9 +209,9 @@ describe('Model: flashState', function() {
}).to.throw('Missing flash fields: speed');
});
it('should not throw if speed is 0', function() {
it('should not throw if speed is 0', function () {
flashState.setFlashingFlag();
expect(function() {
expect(function () {
flashState.setProgressState({
failed: 0,
type: 'flashing',
@ -226,7 +226,7 @@ describe('Model: flashState', function() {
}).to.not.throw('Missing flash fields: speed');
});
it('should floor the percentage number', function() {
it('should floor the percentage number', function () {
flashState.setFlashingFlag();
flashState.setProgressState({
failed: 0,
@ -243,7 +243,7 @@ describe('Model: flashState', function() {
expect(flashState.getFlashState().percentage).to.equal(50);
});
it('should error when any field is non-nil but not a finite number', function() {
it('should error when any field is non-nil but not a finite number', function () {
expect(() => {
flashState.setFlashingFlag();
flashState.setProgressState({
@ -267,7 +267,7 @@ describe('Model: flashState', function() {
}).to.throw('State quantity field(s) not finite number');
});
it('should not error when all quantity fields are zero', function() {
it('should not error when all quantity fields are zero', function () {
expect(() => {
flashState.setFlashingFlag();
flashState.setProgressState({
@ -285,8 +285,8 @@ describe('Model: flashState', function() {
});
});
describe('.getFlashResults()', function() {
it('should get the flash results', function() {
describe('.getFlashResults()', function () {
it('should get the flash results', function () {
flashState.setFlashingFlag();
const expectedResults = {
@ -300,8 +300,8 @@ describe('Model: flashState', function() {
});
});
describe('.getFlashState()', function() {
it('should initially return an empty state', function() {
describe('.getFlashState()', function () {
it('should initially return an empty state', function () {
flashState.resetState();
const currentFlashState = flashState.getFlashState();
expect(currentFlashState).to.deep.equal({
@ -313,7 +313,7 @@ describe('Model: flashState', function() {
});
});
it('should return the current flash state', function() {
it('should return the current flash state', function () {
const state = {
failed: 0,
percentage: 50,
@ -343,15 +343,15 @@ describe('Model: flashState', function() {
});
});
describe('.unsetFlashingFlag()', function() {
it('should throw if no flashing results', function() {
expect(function() {
describe('.unsetFlashingFlag()', function () {
it('should throw if no flashing results', function () {
expect(function () {
// @ts-ignore
flashState.unsetFlashingFlag();
}).to.throw('Missing results');
});
it('should be able to set a string error code', function() {
it('should be able to set a string error code', function () {
flashState.unsetFlashingFlag({
cancelled: false,
sourceChecksum: '1234',
@ -361,7 +361,7 @@ describe('Model: flashState', function() {
expect(flashState.getLastFlashErrorCode()).to.equal('EBUSY');
});
it('should be able to set a number error code', function() {
it('should be able to set a number error code', function () {
flashState.unsetFlashingFlag({
cancelled: false,
sourceChecksum: '1234',
@ -371,8 +371,8 @@ describe('Model: flashState', function() {
expect(flashState.getLastFlashErrorCode()).to.equal(123);
});
it('should throw if errorCode is not a number not a string', function() {
expect(function() {
it('should throw if errorCode is not a number not a string', function () {
expect(function () {
flashState.unsetFlashingFlag({
cancelled: false,
sourceChecksum: '1234',
@ -384,7 +384,7 @@ describe('Model: flashState', function() {
}).to.throw('Invalid results errorCode: [object Object]');
});
it('should default cancelled to false', function() {
it('should default cancelled to false', function () {
flashState.unsetFlashingFlag({
sourceChecksum: '1234',
});
@ -397,8 +397,8 @@ describe('Model: flashState', function() {
});
});
it('should throw if cancelled is not boolean', function() {
expect(function() {
it('should throw if cancelled is not boolean', function () {
expect(function () {
flashState.unsetFlashingFlag({
// @ts-ignore
cancelled: 'false',
@ -407,8 +407,8 @@ describe('Model: flashState', function() {
}).to.throw('Invalid results cancelled: false');
});
it('should throw if cancelled is true and sourceChecksum exists', function() {
expect(function() {
it('should throw if cancelled is true and sourceChecksum exists', function () {
expect(function () {
flashState.unsetFlashingFlag({
cancelled: true,
sourceChecksum: '1234',
@ -418,7 +418,7 @@ describe('Model: flashState', function() {
);
});
it('should be able to set flashing to false', function() {
it('should be able to set flashing to false', function () {
flashState.unsetFlashingFlag({
cancelled: false,
sourceChecksum: '1234',
@ -427,7 +427,7 @@ describe('Model: flashState', function() {
expect(flashState.isFlashing()).to.be.false;
});
it('should reset the flashing state', function() {
it('should reset the flashing state', function () {
flashState.setFlashingFlag();
flashState.setProgressState({
@ -463,7 +463,7 @@ describe('Model: flashState', function() {
});
});
it('should not reset the flash uuid', function() {
it('should not reset the flash uuid', function () {
flashState.setFlashingFlag();
const uuidBeforeUnset = flashState.getFlashUuid();
@ -477,13 +477,13 @@ describe('Model: flashState', function() {
});
});
describe('.setFlashingFlag()', function() {
it('should be able to set flashing to true', function() {
describe('.setFlashingFlag()', function () {
it('should be able to set flashing to true', function () {
flashState.setFlashingFlag();
expect(flashState.isFlashing()).to.be.true;
});
it('should reset the flash results', function() {
it('should reset the flash results', function () {
const expectedResults = {
cancelled: false,
sourceChecksum: '1234',
@ -497,13 +497,13 @@ describe('Model: flashState', function() {
});
});
describe('.wasLastFlashCancelled()', function() {
it('should return false given a pristine state', function() {
describe('.wasLastFlashCancelled()', function () {
it('should return false given a pristine state', function () {
flashState.resetState();
expect(flashState.wasLastFlashCancelled()).to.be.false;
});
it('should return false if !cancelled', function() {
it('should return false if !cancelled', function () {
flashState.unsetFlashingFlag({
sourceChecksum: '1234',
cancelled: false,
@ -512,7 +512,7 @@ describe('Model: flashState', function() {
expect(flashState.wasLastFlashCancelled()).to.be.false;
});
it('should return true if cancelled', function() {
it('should return true if cancelled', function () {
flashState.unsetFlashingFlag({
cancelled: true,
});
@ -521,13 +521,13 @@ describe('Model: flashState', function() {
});
});
describe('.getLastFlashSourceChecksum()', function() {
it('should return undefined given a pristine state', function() {
describe('.getLastFlashSourceChecksum()', function () {
it('should return undefined given a pristine state', function () {
flashState.resetState();
expect(flashState.getLastFlashSourceChecksum()).to.be.undefined;
});
it('should return the last flash source checksum', function() {
it('should return the last flash source checksum', function () {
flashState.unsetFlashingFlag({
sourceChecksum: '1234',
cancelled: false,
@ -536,7 +536,7 @@ describe('Model: flashState', function() {
expect(flashState.getLastFlashSourceChecksum()).to.equal('1234');
});
it('should return undefined if the last flash was cancelled', function() {
it('should return undefined if the last flash was cancelled', function () {
flashState.unsetFlashingFlag({
cancelled: true,
});
@ -545,13 +545,13 @@ describe('Model: flashState', function() {
});
});
describe('.getLastFlashErrorCode()', function() {
it('should return undefined given a pristine state', function() {
describe('.getLastFlashErrorCode()', function () {
it('should return undefined given a pristine state', function () {
flashState.resetState();
expect(flashState.getLastFlashErrorCode()).to.be.undefined;
});
it('should return the last flash error code', function() {
it('should return the last flash error code', function () {
flashState.unsetFlashingFlag({
sourceChecksum: '1234',
cancelled: false,
@ -561,7 +561,7 @@ describe('Model: flashState', function() {
expect(flashState.getLastFlashErrorCode()).to.equal('ENOSPC');
});
it('should return undefined if the last flash did not report an error code', function() {
it('should return undefined if the last flash did not report an error code', function () {
flashState.unsetFlashingFlag({
sourceChecksum: '1234',
cancelled: false,
@ -571,20 +571,20 @@ describe('Model: flashState', function() {
});
});
describe('.getFlashUuid()', function() {
describe('.getFlashUuid()', function () {
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
it('should be initially undefined', function() {
it('should be initially undefined', function () {
expect(flashState.getFlashUuid()).to.be.undefined;
});
it('should be a valid uuid if the flashing flag is set', function() {
it('should be a valid uuid if the flashing flag is set', function () {
flashState.setFlashingFlag();
const uuid = flashState.getFlashUuid();
expect(UUID_REGEX.test(uuid)).to.be.true;
});
it('should return different uuids every time the flashing flag is set', function() {
it('should return different uuids every time the flashing flag is set', function () {
flashState.setFlashingFlag();
const uuid1 = flashState.getFlashUuid();
flashState.unsetFlashingFlag({

View File

@ -21,61 +21,61 @@ import * as path from 'path';
import * as availableDrives from '../../../lib/gui/app/models/available-drives';
import * as selectionState from '../../../lib/gui/app/models/selection-state';
describe('Model: selectionState', function() {
describe('given a clean state', function() {
beforeEach(function() {
describe('Model: selectionState', function () {
describe('given a clean state', function () {
beforeEach(function () {
selectionState.clear();
});
it('getImage() should return undefined', function() {
it('getImage() should return undefined', function () {
expect(selectionState.getImage()).to.be.undefined;
});
it('getImagePath() should return undefined', function() {
it('getImagePath() should return undefined', function () {
expect(selectionState.getImagePath()).to.be.undefined;
});
it('getImageSize() should return undefined', function() {
it('getImageSize() should return undefined', function () {
expect(selectionState.getImageSize()).to.be.undefined;
});
it('getImageUrl() should return undefined', function() {
it('getImageUrl() should return undefined', function () {
expect(selectionState.getImageUrl()).to.be.undefined;
});
it('getImageName() should return undefined', function() {
it('getImageName() should return undefined', function () {
expect(selectionState.getImageName()).to.be.undefined;
});
it('getImageLogo() should return undefined', function() {
it('getImageLogo() should return undefined', function () {
expect(selectionState.getImageLogo()).to.be.undefined;
});
it('getImageSupportUrl() should return undefined', function() {
it('getImageSupportUrl() should return undefined', function () {
expect(selectionState.getImageSupportUrl()).to.be.undefined;
});
it('getImageRecommendedDriveSize() should return undefined', function() {
it('getImageRecommendedDriveSize() should return undefined', function () {
expect(selectionState.getImageRecommendedDriveSize()).to.be.undefined;
});
it('hasDrive() should return false', function() {
it('hasDrive() should return false', function () {
const hasDrive = selectionState.hasDrive();
expect(hasDrive).to.be.false;
});
it('hasImage() should return false', function() {
it('hasImage() should return false', function () {
const hasImage = selectionState.hasImage();
expect(hasImage).to.be.false;
});
it('.getSelectedDrives() should return []', function() {
it('.getSelectedDrives() should return []', function () {
expect(selectionState.getSelectedDrives()).to.deep.equal([]);
});
});
describe('given one available drive', function() {
beforeEach(function() {
describe('given one available drive', function () {
beforeEach(function () {
this.drives = [
{
device: '/dev/disk2',
@ -86,13 +86,13 @@ describe('Model: selectionState', function() {
];
});
afterEach(function() {
afterEach(function () {
selectionState.clear();
availableDrives.setDrives([]);
});
describe('.selectDrive()', function() {
it('should not deselect when warning is attached to image-drive pair', function() {
describe('.selectDrive()', function () {
it('should not deselect when warning is attached to image-drive pair', function () {
this.drives[0].size = 64e10;
availableDrives.setDrives(this.drives);
@ -103,8 +103,8 @@ describe('Model: selectionState', function() {
});
});
describe('given a drive', function() {
beforeEach(function() {
describe('given a drive', function () {
beforeEach(function () {
availableDrives.setDrives([
{
device: '/dev/disk2',
@ -123,19 +123,19 @@ describe('Model: selectionState', function() {
selectionState.selectDrive('/dev/disk2');
});
afterEach(function() {
afterEach(function () {
selectionState.clear();
});
describe('.hasDrive()', function() {
it('should return true', function() {
describe('.hasDrive()', function () {
it('should return true', function () {
const hasDrive = selectionState.hasDrive();
expect(hasDrive).to.be.true;
});
});
describe('.selectDrive()', function() {
it('should queue the drive', function() {
describe('.selectDrive()', function () {
it('should queue the drive', function () {
selectionState.selectDrive('/dev/disk5');
const drives = selectionState.getSelectedDevices();
const lastDriveDevice = _.last(drives);
@ -151,8 +151,8 @@ describe('Model: selectionState', function() {
});
});
describe('.deselectDrive()', function() {
it('should clear drive', function() {
describe('.deselectDrive()', function () {
it('should clear drive', function () {
const firstDevice = selectionState.getSelectedDevices()[0];
selectionState.deselectDrive(firstDevice);
const devices = selectionState.getSelectedDevices();
@ -160,8 +160,8 @@ describe('Model: selectionState', function() {
});
});
describe('.getSelectedDrives()', function() {
it('should return that single selected drive', function() {
describe('.getSelectedDrives()', function () {
it('should return that single selected drive', function () {
expect(selectionState.getSelectedDrives()).to.deep.equal([
{
device: '/dev/disk2',
@ -174,8 +174,8 @@ describe('Model: selectionState', function() {
});
});
describe('given several drives', function() {
beforeEach(function() {
describe('given several drives', function () {
beforeEach(function () {
this.drives = [
{
device: '/dev/sdb',
@ -206,26 +206,26 @@ describe('Model: selectionState', function() {
selectionState.selectDrive(this.drives[1].device);
});
afterEach(function() {
afterEach(function () {
selectionState.clear();
availableDrives.setDrives([]);
});
it('should be able to add more drives', function() {
it('should be able to add more drives', function () {
selectionState.selectDrive(this.drives[2].device);
expect(selectionState.getSelectedDevices()).to.deep.equal(
_.map(this.drives, 'device'),
);
});
it('should be able to remove drives', function() {
it('should be able to remove drives', function () {
selectionState.deselectDrive(this.drives[1].device);
expect(selectionState.getSelectedDevices()).to.deep.equal([
this.drives[0].device,
]);
});
it('should keep system drives selected', function() {
it('should keep system drives selected', function () {
const systemDrive = {
device: '/dev/disk0',
name: 'USB Drive 0',
@ -244,7 +244,7 @@ describe('Model: selectionState', function() {
);
});
it('should be able to remove a drive', function() {
it('should be able to remove a drive', function () {
expect(selectionState.getSelectedDevices().length).to.equal(2);
selectionState.toggleDrive(this.drives[0].device);
expect(selectionState.getSelectedDevices()).to.deep.equal([
@ -252,15 +252,15 @@ describe('Model: selectionState', function() {
]);
});
describe('.deselectAllDrives()', function() {
it('should remove all drives', function() {
describe('.deselectAllDrives()', function () {
it('should remove all drives', function () {
selectionState.deselectAllDrives();
expect(selectionState.getSelectedDevices()).to.deep.equal([]);
});
});
describe('.deselectDrive()', function() {
it('should clear drives', function() {
describe('.deselectDrive()', function () {
it('should clear drives', function () {
const devices = selectionState.getSelectedDevices();
selectionState.deselectDrive(devices[0]);
selectionState.deselectDrive(devices[1]);
@ -268,8 +268,8 @@ describe('Model: selectionState', function() {
});
});
describe('.getSelectedDrives()', function() {
it('should return the selected drives', function() {
describe('.getSelectedDrives()', function () {
it('should return the selected drives', function () {
expect(selectionState.getSelectedDrives()).to.deep.equal([
{
device: '/dev/sdb',
@ -291,9 +291,9 @@ describe('Model: selectionState', function() {
});
});
describe('given no drive', function() {
describe('.selectDrive()', function() {
it('should be able to set a drive', function() {
describe('given no drive', function () {
describe('.selectDrive()', function () {
it('should be able to set a drive', function () {
availableDrives.setDrives([
{
device: '/dev/disk5',
@ -307,7 +307,7 @@ describe('Model: selectionState', function() {
expect(selectionState.getSelectedDevices()[0]).to.equal('/dev/disk5');
});
it('should throw if drive is read-only', function() {
it('should throw if drive is read-only', function () {
availableDrives.setDrives([
{
device: '/dev/disk1',
@ -317,12 +317,12 @@ describe('Model: selectionState', function() {
},
]);
expect(function() {
expect(function () {
selectionState.selectDrive('/dev/disk1');
}).to.throw('The drive is write-protected');
});
it('should throw if the drive is not available', function() {
it('should throw if the drive is not available', function () {
availableDrives.setDrives([
{
device: '/dev/disk1',
@ -332,13 +332,13 @@ describe('Model: selectionState', function() {
},
]);
expect(function() {
expect(function () {
selectionState.selectDrive('/dev/disk5');
}).to.throw('The drive is not available: /dev/disk5');
});
it('should throw if device is not a string', function() {
expect(function() {
it('should throw if device is not a string', function () {
expect(function () {
// @ts-ignore
selectionState.selectDrive(123);
}).to.throw('Invalid drive: 123');
@ -346,8 +346,8 @@ describe('Model: selectionState', function() {
});
});
describe('given an image', function() {
beforeEach(function() {
describe('given an image', function () {
beforeEach(function () {
this.image = {
path: 'foo.img',
extension: 'img',
@ -362,8 +362,8 @@ describe('Model: selectionState', function() {
selectionState.selectImage(this.image);
});
describe('.selectDrive()', function() {
it('should throw if drive is not large enough', function() {
describe('.selectDrive()', function () {
it('should throw if drive is not large enough', function () {
availableDrives.setDrives([
{
device: '/dev/disk2',
@ -373,48 +373,48 @@ describe('Model: selectionState', function() {
},
]);
expect(function() {
expect(function () {
selectionState.selectDrive('/dev/disk2');
}).to.throw('The drive is not large enough');
});
});
describe('.getImage()', function() {
it('should return the image', function() {
describe('.getImage()', function () {
it('should return the image', function () {
expect(selectionState.getImage()).to.deep.equal(this.image);
});
});
describe('.getImagePath()', function() {
it('should return the image path', function() {
describe('.getImagePath()', function () {
it('should return the image path', function () {
const imagePath = selectionState.getImagePath();
expect(imagePath).to.equal('foo.img');
});
});
describe('.getImageSize()', function() {
it('should return the image size', function() {
describe('.getImageSize()', function () {
it('should return the image size', function () {
const imageSize = selectionState.getImageSize();
expect(imageSize).to.equal(999999999);
});
});
describe('.getImageUrl()', function() {
it('should return the image url', function() {
describe('.getImageUrl()', function () {
it('should return the image url', function () {
const imageUrl = selectionState.getImageUrl();
expect(imageUrl).to.equal('https://www.raspbian.org');
});
});
describe('.getImageName()', function() {
it('should return the image name', function() {
describe('.getImageName()', function () {
it('should return the image name', function () {
const imageName = selectionState.getImageName();
expect(imageName).to.equal('Raspbian');
});
});
describe('.getImageLogo()', function() {
it('should return the image logo', function() {
describe('.getImageLogo()', function () {
it('should return the image logo', function () {
const imageLogo = selectionState.getImageLogo();
expect(imageLogo).to.equal(
'<svg><text fill="red">Raspbian</text></svg>',
@ -422,29 +422,29 @@ describe('Model: selectionState', function() {
});
});
describe('.getImageSupportUrl()', function() {
it('should return the image support url', function() {
describe('.getImageSupportUrl()', function () {
it('should return the image support url', function () {
const imageSupportUrl = selectionState.getImageSupportUrl();
expect(imageSupportUrl).to.equal('https://www.raspbian.org/forums/');
});
});
describe('.getImageRecommendedDriveSize()', function() {
it('should return the image recommended drive size', function() {
describe('.getImageRecommendedDriveSize()', function () {
it('should return the image recommended drive size', function () {
const imageRecommendedDriveSize = selectionState.getImageRecommendedDriveSize();
expect(imageRecommendedDriveSize).to.equal(1000000000);
});
});
describe('.hasImage()', function() {
it('should return true', function() {
describe('.hasImage()', function () {
it('should return true', function () {
const hasImage = selectionState.hasImage();
expect(hasImage).to.be.true;
});
});
describe('.selectImage()', function() {
it('should override the image', function() {
describe('.selectImage()', function () {
it('should override the image', function () {
selectionState.selectImage({
path: 'bar.img',
extension: 'img',
@ -459,8 +459,8 @@ describe('Model: selectionState', function() {
});
});
describe('.deselectImage()', function() {
it('should clear the image', function() {
describe('.deselectImage()', function () {
it('should clear the image', function () {
selectionState.deselectImage();
const imagePath = selectionState.getImagePath();
@ -471,11 +471,11 @@ describe('Model: selectionState', function() {
});
});
describe('given no image', function() {
describe('.selectImage()', function() {
describe('given no image', function () {
describe('.selectImage()', function () {
afterEach(selectionState.clear);
it('should be able to set an image', function() {
it('should be able to set an image', function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -489,7 +489,7 @@ describe('Model: selectionState', function() {
expect(imageSize).to.equal(999999999);
});
it('should be able to set an image with an archive extension', function() {
it('should be able to set an image with an archive extension', function () {
selectionState.selectImage({
path: 'foo.zip',
extension: 'img',
@ -502,7 +502,7 @@ describe('Model: selectionState', function() {
expect(imagePath).to.equal('foo.zip');
});
it('should infer a compressed raw image if the penultimate extension is missing', function() {
it('should infer a compressed raw image if the penultimate extension is missing', function () {
selectionState.selectImage({
path: 'foo.xz',
extension: 'img',
@ -515,7 +515,7 @@ describe('Model: selectionState', function() {
expect(imagePath).to.equal('foo.xz');
});
it('should infer a compressed raw image if the penultimate extension is not a file extension', function() {
it('should infer a compressed raw image if the penultimate extension is not a file extension', function () {
selectionState.selectImage({
path: 'something.linux-x86-64.gz',
extension: 'img',
@ -528,8 +528,8 @@ describe('Model: selectionState', function() {
expect(imagePath).to.equal('something.linux-x86-64.gz');
});
it('should throw if no path', function() {
expect(function() {
it('should throw if no path', function () {
expect(function () {
selectionState.selectImage({
extension: 'img',
size: 999999999,
@ -538,8 +538,8 @@ describe('Model: selectionState', function() {
}).to.throw('Missing image fields: path');
});
it('should throw if path is not a string', function() {
expect(function() {
it('should throw if path is not a string', function () {
expect(function () {
selectionState.selectImage({
path: 123,
extension: 'img',
@ -549,8 +549,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image path: 123');
});
it('should throw if no extension', function() {
expect(function() {
it('should throw if no extension', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
size: 999999999,
@ -559,8 +559,8 @@ describe('Model: selectionState', function() {
}).to.throw('Missing image fields: extension');
});
it('should throw if extension is not a string', function() {
expect(function() {
it('should throw if extension is not a string', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 1,
@ -570,8 +570,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image extension: 1');
});
it("should throw if the extension doesn't match the path and there is no archive extension", function() {
expect(function() {
it("should throw if the extension doesn't match the path and there is no archive extension", function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'iso',
@ -581,8 +581,8 @@ describe('Model: selectionState', function() {
}).to.throw('Missing image archive extension');
});
it("should throw if the extension doesn't match the path and the archive extension is not a string", function() {
expect(function() {
it("should throw if the extension doesn't match the path and the archive extension is not a string", function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'iso',
@ -593,8 +593,8 @@ describe('Model: selectionState', function() {
}).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() {
expect(function() {
it("should throw if the archive extension doesn't match the last path extension in a compressed image", function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img.xz',
extension: 'img',
@ -605,8 +605,8 @@ describe('Model: selectionState', function() {
}).to.throw('Image archive extension mismatch: gz and xz');
});
it('should throw if the extension is not recognised in an uncompressed image', function() {
expect(function() {
it('should throw if the extension is not recognised in an uncompressed image', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.ifg',
extension: 'ifg',
@ -616,8 +616,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image extension: ifg');
});
it('should throw if the extension is not recognised in a compressed image', function() {
expect(function() {
it('should throw if the extension is not recognised in a compressed image', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.ifg.gz',
extension: 'ifg',
@ -628,8 +628,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image extension: ifg');
});
it('should throw if the archive extension is not recognised', function() {
expect(function() {
it('should throw if the archive extension is not recognised', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img.ifg',
extension: 'img',
@ -640,8 +640,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image archive extension: ifg');
});
it('should throw if the original size is not a number', function() {
expect(function() {
it('should throw if the original size is not a number', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -652,8 +652,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image compressed size: 999999999');
});
it('should throw if the original size is a float number', function() {
expect(function() {
it('should throw if the original size is a float number', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -664,8 +664,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image compressed size: 999999999.999');
});
it('should throw if the original size is negative', function() {
expect(function() {
it('should throw if the original size is negative', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -676,8 +676,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image compressed size: -1');
});
it('should throw if the final size is not a number', function() {
expect(function() {
it('should throw if the final size is not a number', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -687,8 +687,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image size: 999999999');
});
it('should throw if the final size is a float number', function() {
expect(function() {
it('should throw if the final size is a float number', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -698,8 +698,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image size: 999999999.999');
});
it('should throw if the final size is negative', function() {
expect(function() {
it('should throw if the final size is negative', function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -709,8 +709,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image size: -1');
});
it("should throw if url is defined but it's not a string", function() {
expect(function() {
it("should throw if url is defined but it's not a string", function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -721,8 +721,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image url: 1234');
});
it("should throw if name is defined but it's not a string", function() {
expect(function() {
it("should throw if name is defined but it's not a string", function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -733,8 +733,8 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image name: 1234');
});
it("should throw if logo is defined but it's not a string", function() {
expect(function() {
it("should throw if logo is defined but it's not a string", function () {
expect(function () {
selectionState.selectImage({
path: 'foo.img',
extension: 'img',
@ -745,7 +745,7 @@ describe('Model: selectionState', function() {
}).to.throw('Invalid image logo: 1234');
});
it('should de-select a previously selected not-large-enough drive', function() {
it('should de-select a previously selected not-large-enough drive', function () {
availableDrives.setDrives([
{
device: '/dev/disk1',
@ -769,7 +769,7 @@ describe('Model: selectionState', function() {
selectionState.deselectImage();
});
it('should de-select a previously selected not-recommended drive', function() {
it('should de-select a previously selected not-recommended drive', function () {
availableDrives.setDrives([
{
device: '/dev/disk1',
@ -794,7 +794,7 @@ describe('Model: selectionState', function() {
selectionState.deselectImage();
});
it('should de-select a previously selected source drive', function() {
it('should de-select a previously selected source drive', function () {
const imagePath =
process.platform === 'win32'
? 'E:\\bar\\foo.img'
@ -830,8 +830,8 @@ describe('Model: selectionState', function() {
});
});
describe('given a drive and an image', function() {
beforeEach(function() {
describe('given a drive and an image', function () {
beforeEach(function () {
availableDrives.setDrives([
{
device: '/dev/disk1',
@ -851,8 +851,8 @@ describe('Model: selectionState', function() {
});
});
describe('.clear()', function() {
it('should clear all selections', function() {
describe('.clear()', function () {
it('should clear all selections', function () {
expect(selectionState.hasDrive()).to.be.true;
expect(selectionState.hasImage()).to.be.true;
@ -863,59 +863,59 @@ describe('Model: selectionState', function() {
});
});
describe('.deselectImage()', function() {
beforeEach(function() {
describe('.deselectImage()', function () {
beforeEach(function () {
selectionState.deselectImage();
});
it('getImagePath() should return undefined', function() {
it('getImagePath() should return undefined', function () {
const imagePath = selectionState.getImagePath();
expect(imagePath).to.be.undefined;
});
it('getImageSize() should return undefined', function() {
it('getImageSize() should return undefined', function () {
const imageSize = selectionState.getImageSize();
expect(imageSize).to.be.undefined;
});
it('should not clear any drives', function() {
it('should not clear any drives', function () {
expect(selectionState.hasDrive()).to.be.true;
});
it('hasImage() should return false', function() {
it('hasImage() should return false', function () {
const hasImage = selectionState.hasImage();
expect(hasImage).to.be.false;
});
});
describe('.deselectAllDrives()', function() {
beforeEach(function() {
describe('.deselectAllDrives()', function () {
beforeEach(function () {
selectionState.deselectAllDrives();
});
it('getImagePath() should return the image path', function() {
it('getImagePath() should return the image path', function () {
const imagePath = selectionState.getImagePath();
expect(imagePath).to.equal('foo.img');
});
it('getImageSize() should return the image size', function() {
it('getImageSize() should return the image size', function () {
const imageSize = selectionState.getImageSize();
expect(imageSize).to.equal(999999999);
});
it('hasDrive() should return false', function() {
it('hasDrive() should return false', function () {
const hasDrive = selectionState.hasDrive();
expect(hasDrive).to.be.false;
});
it('should not clear the image', function() {
it('should not clear the image', function () {
expect(selectionState.hasImage()).to.be.true;
});
});
});
describe('given several drives', function() {
beforeEach(function() {
describe('given several drives', function () {
beforeEach(function () {
availableDrives.setDrives([
{
device: '/dev/disk1',
@ -949,8 +949,8 @@ describe('Model: selectionState', function() {
});
});
describe('.clear()', function() {
it('should clear all selections', function() {
describe('.clear()', function () {
it('should clear all selections', function () {
expect(selectionState.hasDrive()).to.be.true;
expect(selectionState.hasImage()).to.be.true;
@ -962,9 +962,9 @@ describe('Model: selectionState', function() {
});
});
describe('.toggleDrive()', function() {
describe('given a selected drive', function() {
beforeEach(function() {
describe('.toggleDrive()', function () {
describe('given a selected drive', function () {
beforeEach(function () {
this.drive = {
device: '/dev/sdb',
description: 'DataTraveler 2.0',
@ -992,18 +992,18 @@ describe('Model: selectionState', function() {
selectionState.selectDrive(this.drive.device);
});
afterEach(function() {
afterEach(function () {
selectionState.clear();
availableDrives.setDrives([]);
});
it('should be able to remove the drive', function() {
it('should be able to remove the drive', function () {
expect(selectionState.hasDrive()).to.be.true;
selectionState.toggleDrive(this.drive.device);
expect(selectionState.hasDrive()).to.be.false;
});
it('should not replace a different drive', function() {
it('should not replace a different drive', function () {
const drive = {
device: '/dev/disk2',
name: 'USB Drive',
@ -1021,8 +1021,8 @@ describe('Model: selectionState', function() {
});
});
describe('given no selected drive', function() {
beforeEach(function() {
describe('given no selected drive', function () {
beforeEach(function () {
selectionState.clear();
availableDrives.setDrives([
@ -1041,11 +1041,11 @@ describe('Model: selectionState', function() {
]);
});
afterEach(function() {
afterEach(function () {
availableDrives.setDrives([]);
});
it('should set the drive', function() {
it('should set the drive', function () {
const drive = {
device: '/dev/disk2',
name: 'USB Drive 2',

View File

@ -31,14 +31,14 @@ async function checkError(promise: Promise<any>, fn: (err: Error) => void) {
throw new Error('Expected error was not thrown');
}
describe('Browser: settings', function() {
beforeEach(function() {
describe('Browser: settings', function () {
beforeEach(function () {
return settings.reset();
});
const DEFAULT_SETTINGS = _.cloneDeep(settings.DEFAULT_SETTINGS);
it('should be able to set and read values', function() {
it('should be able to set and read values', function () {
expect(settings.get('foo')).to.be.undefined;
return settings
.set('foo', true)
@ -51,8 +51,8 @@ describe('Browser: settings', function() {
});
});
describe('.reset()', function() {
it('should reset the settings to their default values', function() {
describe('.reset()', function () {
it('should reset the settings to their default values', function () {
expect(settings.getAll()).to.deep.equal(DEFAULT_SETTINGS);
return settings
.set('foo', 1234)
@ -65,41 +65,41 @@ describe('Browser: settings', function() {
});
});
it('should reset the local settings to their default values', function() {
it('should reset the local settings to their default values', function () {
return settings
.set('foo', 1234)
.then(localSettings.readAll)
.then(data => {
.then((data) => {
expect(data).to.not.deep.equal(DEFAULT_SETTINGS);
return settings.reset();
})
.then(localSettings.readAll)
.then(data => {
.then((data) => {
expect(data).to.deep.equal(DEFAULT_SETTINGS);
});
});
describe('given the local settings are cleared', function() {
beforeEach(function() {
describe('given the local settings are cleared', function () {
beforeEach(function () {
return localSettings.clear();
});
it('should set the local settings to their default values', function() {
it('should set the local settings to their default values', function () {
return settings
.reset()
.then(localSettings.readAll)
.then(data => {
.then((data) => {
expect(data).to.deep.equal(DEFAULT_SETTINGS);
});
});
});
});
describe('.set()', function() {
it('should store the settings to the local machine', function() {
describe('.set()', function () {
it('should store the settings to the local machine', function () {
return localSettings
.readAll()
.then(data => {
.then((data) => {
expect(data.foo).to.be.undefined;
expect(data.bar).to.be.undefined;
return settings.set('foo', 'bar');
@ -108,13 +108,13 @@ describe('Browser: settings', function() {
return settings.set('bar', 'baz');
})
.then(localSettings.readAll)
.then(data => {
.then((data) => {
expect(data.foo).to.equal('bar');
expect(data.bar).to.equal('baz');
});
});
it('should not change the application state if storing to the local machine results in an error', async function() {
it('should not change the application state if storing to the local machine results in an error', async function () {
await settings.set('foo', 'bar');
expect(settings.get('foo')).to.equal('bar');
@ -123,7 +123,7 @@ describe('Browser: settings', function() {
Promise.reject(new Error('localSettings error')),
);
await checkError(settings.set('foo', 'baz'), error => {
await checkError(settings.set('foo', 'baz'), (error) => {
expect(error).to.be.an.instanceof(Error);
expect(error.message).to.equal('localSettings error');
localSettingsWriteAllStub.restore();
@ -132,8 +132,8 @@ describe('Browser: settings', function() {
});
});
describe('.load()', function() {
it('should extend the application state with the local settings content', function() {
describe('.load()', function () {
it('should extend the application state with the local settings content', function () {
const object = {
foo: 'bar',
};
@ -153,7 +153,7 @@ describe('Browser: settings', function() {
});
});
it('should keep the application state intact if there are no local settings', function() {
it('should keep the application state intact if there are no local settings', function () {
expect(settings.getAll()).to.deep.equal(DEFAULT_SETTINGS);
return localSettings
.clear()
@ -164,15 +164,15 @@ describe('Browser: settings', function() {
});
});
describe('.set()', function() {
it('should set an unknown key', function() {
describe('.set()', function () {
it('should set an unknown key', function () {
expect(settings.get('foobar')).to.be.undefined;
return settings.set('foobar', true).then(() => {
expect(settings.get('foobar')).to.be.true;
});
});
it('should set the key to undefined if no value', function() {
it('should set the key to undefined if no value', function () {
return settings
.set('foo', 'bar')
.then(() => {
@ -184,20 +184,20 @@ describe('Browser: settings', function() {
});
});
it('should store the setting to the local machine', function() {
it('should store the setting to the local machine', function () {
return localSettings
.readAll()
.then(data => {
.then((data) => {
expect(data.foo).to.be.undefined;
return settings.set('foo', 'bar');
})
.then(localSettings.readAll)
.then(data => {
.then((data) => {
expect(data.foo).to.equal('bar');
});
});
it('should not change the application state if storing to the local machine results in an error', async function() {
it('should not change the application state if storing to the local machine results in an error', async function () {
await settings.set('foo', 'bar');
expect(settings.get('foo')).to.equal('bar');
@ -206,7 +206,7 @@ describe('Browser: settings', function() {
Promise.reject(new Error('localSettings error')),
);
await checkError(settings.set('foo', 'baz'), error => {
await checkError(settings.set('foo', 'baz'), (error) => {
expect(error).to.be.an.instanceof(Error);
expect(error.message).to.equal('localSettings error');
localSettingsWriteAllStub.restore();
@ -215,8 +215,8 @@ describe('Browser: settings', function() {
});
});
describe('.getAll()', function() {
it('should initial return all default values', function() {
describe('.getAll()', function () {
it('should initial return all default values', function () {
expect(settings.getAll()).to.deep.equal(DEFAULT_SETTINGS);
});
});

View File

@ -19,8 +19,8 @@ import * as ipc from 'node-ipc';
import('../../../lib/gui/modules/child-writer');
describe('Browser: childWriter', function() {
it('should have the ipc config set to silent', function() {
describe('Browser: childWriter', function () {
it('should have the ipc config set to silent', function () {
expect(ipc.config.silent).to.be.true;
});
});

View File

@ -86,7 +86,7 @@ describe('Browser: imageWriter', () => {
let rejectError: Error;
imageWriter
.flash(imagePath, [fakeDrive], sourceOptions)
.catch(error => {
.catch((error) => {
rejectError = error;
})
.finally(() => {
@ -140,7 +140,7 @@ describe('Browser: imageWriter', () => {
let rejection: Error;
imageWriter
.flash(imagePath, [fakeDrive], sourceOptions)
.catch(error => {
.catch((error) => {
rejection = error;
})
.finally(() => {
@ -151,8 +151,8 @@ describe('Browser: imageWriter', () => {
});
});
describe('.performWrite()', function() {
it('should set the ipc config to silent', function() {
describe('.performWrite()', function () {
it('should set the ipc config to silent', function () {
// Reset this value as it can persist from other tests
expect(ipc.config.silent).to.be.true;
});

View File

@ -19,9 +19,9 @@ import { expect } from 'chai';
import * as settings from '../../../lib/gui/app/models/settings';
import * as progressStatus from '../../../lib/gui/app/modules/progress-status';
describe('Browser: progressStatus', function() {
describe('.fromFlashState()', function() {
beforeEach(function() {
describe('Browser: progressStatus', function () {
describe('.fromFlashState()', function () {
beforeEach(function () {
this.state = {
active: 1,
type: 'flashing',
@ -35,22 +35,22 @@ describe('Browser: progressStatus', function() {
settings.set('validateWriteOnSuccess', true);
});
it('should report 0% if percentage == 0 but speed != 0', function() {
it('should report 0% if percentage == 0 but speed != 0', function () {
expect(progressStatus.fromFlashState(this.state)).to.equal('0% Flashing');
});
it('should handle percentage == 0, flashing, unmountOnSuccess', function() {
it('should handle percentage == 0, flashing, unmountOnSuccess', function () {
this.state.speed = 0;
expect(progressStatus.fromFlashState(this.state)).to.equal('0% Flashing');
});
it('should handle percentage == 0, flashing, !unmountOnSuccess', function() {
it('should handle percentage == 0, flashing, !unmountOnSuccess', function () {
this.state.speed = 0;
settings.set('unmountOnSuccess', false);
expect(progressStatus.fromFlashState(this.state)).to.equal('0% Flashing');
});
it('should handle percentage == 0, verifying, unmountOnSuccess', function() {
it('should handle percentage == 0, verifying, unmountOnSuccess', function () {
this.state.speed = 0;
this.state.type = 'verifying';
expect(progressStatus.fromFlashState(this.state)).to.equal(
@ -58,7 +58,7 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 0, verifying, !unmountOnSuccess', function() {
it('should handle percentage == 0, verifying, !unmountOnSuccess', function () {
this.state.speed = 0;
this.state.type = 'verifying';
settings.set('unmountOnSuccess', false);
@ -67,14 +67,14 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 50, flashing, unmountOnSuccess', function() {
it('should handle percentage == 50, flashing, unmountOnSuccess', function () {
this.state.percentage = 50;
expect(progressStatus.fromFlashState(this.state)).to.equal(
'50% Flashing',
);
});
it('should handle percentage == 50, flashing, !unmountOnSuccess', function() {
it('should handle percentage == 50, flashing, !unmountOnSuccess', function () {
this.state.percentage = 50;
settings.set('unmountOnSuccess', false);
expect(progressStatus.fromFlashState(this.state)).to.equal(
@ -82,7 +82,7 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 50, verifying, unmountOnSuccess', function() {
it('should handle percentage == 50, verifying, unmountOnSuccess', function () {
this.state.percentage = 50;
this.state.type = 'verifying';
expect(progressStatus.fromFlashState(this.state)).to.equal(
@ -90,7 +90,7 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 50, verifying, !unmountOnSuccess', function() {
it('should handle percentage == 50, verifying, !unmountOnSuccess', function () {
this.state.percentage = 50;
this.state.type = 'verifying';
settings.set('unmountOnSuccess', false);
@ -99,14 +99,14 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 100, flashing, unmountOnSuccess, validateWriteOnSuccess', function() {
it('should handle percentage == 100, flashing, unmountOnSuccess, validateWriteOnSuccess', function () {
this.state.percentage = 100;
expect(progressStatus.fromFlashState(this.state)).to.equal(
'Finishing...',
);
});
it('should handle percentage == 100, flashing, unmountOnSuccess, !validateWriteOnSuccess', function() {
it('should handle percentage == 100, flashing, unmountOnSuccess, !validateWriteOnSuccess', function () {
this.state.percentage = 100;
settings.set('validateWriteOnSuccess', false);
expect(progressStatus.fromFlashState(this.state)).to.equal(
@ -114,7 +114,7 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 100, flashing, !unmountOnSuccess, !validateWriteOnSuccess', function() {
it('should handle percentage == 100, flashing, !unmountOnSuccess, !validateWriteOnSuccess', function () {
this.state.percentage = 100;
settings.set('unmountOnSuccess', false);
settings.set('validateWriteOnSuccess', false);
@ -123,7 +123,7 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 100, verifying, unmountOnSuccess', function() {
it('should handle percentage == 100, verifying, unmountOnSuccess', function () {
this.state.percentage = 100;
this.state.type = 'verifying';
expect(progressStatus.fromFlashState(this.state)).to.equal(
@ -131,7 +131,7 @@ describe('Browser: progressStatus', function() {
);
});
it('should handle percentage == 100, validatinf, !unmountOnSuccess', function() {
it('should handle percentage == 100, validatinf, !unmountOnSuccess', function () {
this.state.percentage = 100;
settings.set('unmountOnSuccess', false);
expect(progressStatus.fromFlashState(this.state)).to.equal(

View File

@ -19,10 +19,10 @@ import { assert, spy } from 'sinon';
import * as windowProgress from '../../../lib/gui/app/os/window-progress';
describe('Browser: WindowProgress', function() {
describe('windowProgress', function() {
describe('given a stubbed current window', function() {
beforeEach(function() {
describe('Browser: WindowProgress', function () {
describe('windowProgress', function () {
describe('given a stubbed current window', function () {
beforeEach(function () {
this.setProgressBarSpy = spy();
this.setTitleSpy = spy();
@ -38,72 +38,72 @@ describe('Browser: WindowProgress', function() {
};
});
describe('.set()', function() {
it('should translate 0-100 percentages to 0-1 ranges', function() {
describe('.set()', function () {
it('should translate 0-100 percentages to 0-1 ranges', function () {
windowProgress.set(this.state);
assert.calledWith(this.setProgressBarSpy, 0.85);
});
it('should set 0 given 0', function() {
it('should set 0 given 0', function () {
this.state.percentage = 0;
windowProgress.set(this.state);
assert.calledWith(this.setProgressBarSpy, 0);
});
it('should set 1 given 100', function() {
it('should set 1 given 100', function () {
this.state.percentage = 100;
windowProgress.set(this.state);
assert.calledWith(this.setProgressBarSpy, 1);
});
it('should throw if given a percentage higher than 100', function() {
it('should throw if given a percentage higher than 100', function () {
this.state.percentage = 101;
const state = this.state;
expect(function() {
expect(function () {
windowProgress.set(state);
}).to.throw('Invalid percentage: 101');
});
it('should throw if given a percentage less than 0', function() {
it('should throw if given a percentage less than 0', function () {
this.state.percentage = -1;
const state = this.state;
expect(function() {
expect(function () {
windowProgress.set(state);
}).to.throw('Invalid percentage: -1');
});
it('should set the flashing title', function() {
it('should set the flashing title', function () {
windowProgress.set(this.state);
assert.calledWith(this.setTitleSpy, ' 85% Flashing');
});
it('should set the verifying title', function() {
it('should set the verifying title', function () {
this.state.type = 'verifying';
windowProgress.set(this.state);
assert.calledWith(this.setTitleSpy, ' 85% Validating');
});
it('should set the starting title', function() {
it('should set the starting title', function () {
this.state.percentage = 0;
this.state.speed = 0;
windowProgress.set(this.state);
assert.calledWith(this.setTitleSpy, ' 0% Flashing');
});
it('should set the finishing title', function() {
it('should set the finishing title', function () {
this.state.percentage = 100;
windowProgress.set(this.state);
assert.calledWith(this.setTitleSpy, ' Finishing...');
});
});
describe('.clear()', function() {
it('should set -1', function() {
describe('.clear()', function () {
it('should set -1', function () {
windowProgress.clear();
assert.calledWith(this.setProgressBarSpy, -1);
});
it('should clear the window title', function() {
it('should clear the window title', function () {
windowProgress.clear();
assert.calledWith(this.setTitleSpy, '');
});

View File

@ -18,16 +18,16 @@ import { expect } from 'chai';
import { middleEllipsis } from '../../../lib/gui/app/utils/middle-ellipsis';
describe('Browser: MiddleEllipsis', function() {
describe('.middleEllipsis()', function() {
it('should throw error if limit < 3', function() {
describe('Browser: MiddleEllipsis', function () {
describe('.middleEllipsis()', function () {
it('should throw error if limit < 3', function () {
expect(() => {
middleEllipsis('No', 2);
}).to.throw('middleEllipsis: Limit should be at least 3');
});
describe('given the input length is greater than the limit', function() {
it('should always truncate input to an odd length', function() {
describe('given the input length is greater than the limit', function () {
it('should always truncate input to an odd length', function () {
const alphabet = 'abcdefghijklmnopqrstuvwxyz';
expect(middleEllipsis(alphabet, 3)).to.have.lengthOf(3);
expect(middleEllipsis(alphabet, 4)).to.have.lengthOf(3);
@ -36,7 +36,7 @@ describe('Browser: MiddleEllipsis', function() {
});
});
it('should return the input if it is within the bounds of limit', function() {
it('should return the input if it is within the bounds of limit', function () {
expect(middleEllipsis('Hello', 10)).to.equal('Hello');
});
});

File diff suppressed because it is too large Load Diff

View File

@ -19,16 +19,16 @@ import * as _ from 'lodash';
import * as errors from '../../lib/shared/errors';
describe('Shared: Errors', function() {
describe('.HUMAN_FRIENDLY', function() {
it('should be a plain object', function() {
describe('Shared: Errors', function () {
describe('.HUMAN_FRIENDLY', function () {
it('should be a plain object', function () {
expect(_.isPlainObject(errors.HUMAN_FRIENDLY)).to.be.true;
});
it('should contain title and description function properties', function() {
it('should contain title and description function properties', function () {
expect(
_.every(
_.map(errors.HUMAN_FRIENDLY, error => {
_.map(errors.HUMAN_FRIENDLY, (error) => {
return _.isFunction(error.title) && _.isFunction(error.description);
}),
),
@ -36,89 +36,89 @@ describe('Shared: Errors', function() {
});
});
describe('.getTitle()', function() {
it('should accept a string', function() {
describe('.getTitle()', function () {
it('should accept a string', function () {
const error = 'This is an error';
// @ts-ignore
expect(errors.getTitle(error)).to.equal('This is an error');
});
it('should accept a number 0', function() {
it('should accept a number 0', function () {
const error = 0;
// @ts-ignore
expect(errors.getTitle(error)).to.equal('0');
});
it('should accept a number 1', function() {
it('should accept a number 1', function () {
const error = 1;
// @ts-ignore
expect(errors.getTitle(error)).to.equal('1');
});
it('should accept a number -1', function() {
it('should accept a number -1', function () {
const error = -1;
// @ts-ignore
expect(errors.getTitle(error)).to.equal('-1');
});
it('should accept an array', function() {
it('should accept an array', function () {
const error = [0, 1, 2];
// @ts-ignore
expect(errors.getTitle(error)).to.equal('0,1,2');
});
it('should return a generic error message if the error is an empty object', function() {
it('should return a generic error message if the error is an empty object', function () {
const error = {};
// @ts-ignore
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should return a generic error message if the error is undefined', function() {
it('should return a generic error message if the error is undefined', function () {
const error = undefined;
// @ts-ignore
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should return a generic error message if the error is null', function() {
it('should return a generic error message if the error is null', function () {
const error = null;
// @ts-ignore
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should return the error message', function() {
it('should return the error message', function () {
const error = new Error('This is an error');
expect(errors.getTitle(error)).to.equal('This is an error');
});
it('should return the error code if there is no message', function() {
it('should return the error code if there is no message', function () {
const error = new Error();
// @ts-ignore
error.code = 'MYERROR';
expect(errors.getTitle(error)).to.equal('Error code: MYERROR');
});
it('should prioritize the message over the code', function() {
it('should prioritize the message over the code', function () {
const error = new Error('Foo bar');
// @ts-ignore
error.code = 'MYERROR';
expect(errors.getTitle(error)).to.equal('Foo bar');
});
it('should prioritize the code over the message if the message is an empty string', function() {
it('should prioritize the code over the message if the message is an empty string', function () {
const error = new Error('');
// @ts-ignore
error.code = 'MYERROR';
expect(errors.getTitle(error)).to.equal('Error code: MYERROR');
});
it('should prioritize the code over the message if the message is a blank string', function() {
it('should prioritize the code over the message if the message is a blank string', function () {
const error = new Error(' ');
// @ts-ignore
error.code = 'MYERROR';
expect(errors.getTitle(error)).to.equal('Error code: MYERROR');
});
it('should understand an error-like object with a code', function() {
it('should understand an error-like object with a code', function () {
const error = {
code: 'MYERROR',
};
@ -127,7 +127,7 @@ describe('Shared: Errors', function() {
expect(errors.getTitle(error)).to.equal('Error code: MYERROR');
});
it('should understand an error-like object with a message', function() {
it('should understand an error-like object with a message', function () {
const error = {
message: 'Hello world',
};
@ -136,7 +136,7 @@ describe('Shared: Errors', function() {
expect(errors.getTitle(error)).to.equal('Hello world');
});
it('should understand an error-like object with a message and a code', function() {
it('should understand an error-like object with a message and a code', function () {
const error = {
message: 'Hello world',
code: 'MYERROR',
@ -146,57 +146,57 @@ describe('Shared: Errors', function() {
expect(errors.getTitle(error)).to.equal('Hello world');
});
it('should display an error code 0', function() {
it('should display an error code 0', function () {
const error = new Error();
// @ts-ignore
error.code = 0;
expect(errors.getTitle(error)).to.equal('Error code: 0');
});
it('should display an error code 1', function() {
it('should display an error code 1', function () {
const error = new Error();
// @ts-ignore
error.code = 1;
expect(errors.getTitle(error)).to.equal('Error code: 1');
});
it('should display an error code -1', function() {
it('should display an error code -1', function () {
const error = new Error();
// @ts-ignore
error.code = -1;
expect(errors.getTitle(error)).to.equal('Error code: -1');
});
it('should not display an empty string error code', function() {
it('should not display an empty string error code', function () {
const error = new Error();
// @ts-ignore
error.code = '';
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should not display a blank string error code', function() {
it('should not display a blank string error code', function () {
const error = new Error();
// @ts-ignore
error.code = ' ';
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should return a generic error message if no information was found', function() {
it('should return a generic error message if no information was found', function () {
const error = new Error();
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should return a generic error message if no code and the message is empty', function() {
it('should return a generic error message if no code and the message is empty', function () {
const error = new Error('');
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should return a generic error message if no code and the message is blank', function() {
it('should return a generic error message if no code and the message is blank', function () {
const error = new Error(' ');
expect(errors.getTitle(error)).to.equal('An error ocurred');
});
it('should rephrase an ENOENT error', function() {
it('should rephrase an ENOENT error', function () {
const error = new Error('ENOENT error');
// @ts-ignore
error.path = '/foo/bar';
@ -207,7 +207,7 @@ describe('Shared: Errors', function() {
);
});
it('should rephrase an EPERM error', function() {
it('should rephrase an EPERM error', function () {
const error = new Error('EPERM error');
// @ts-ignore
error.code = 'EPERM';
@ -216,7 +216,7 @@ describe('Shared: Errors', function() {
);
});
it('should rephrase an EACCES error', function() {
it('should rephrase an EACCES error', function () {
const error = new Error('EACCES error');
// @ts-ignore
error.code = 'EACCES';
@ -225,7 +225,7 @@ describe('Shared: Errors', function() {
);
});
it('should rephrase an ENOMEM error', function() {
it('should rephrase an ENOMEM error', function () {
const error = new Error('ENOMEM error');
// @ts-ignore
error.code = 'ENOMEM';
@ -233,44 +233,44 @@ describe('Shared: Errors', function() {
});
});
describe('.getDescription()', function() {
it('should return an empty string if the error is a string', function() {
describe('.getDescription()', function () {
it('should return an empty string if the error is a string', function () {
const error = 'My error';
// @ts-ignore
expect(errors.getDescription(error)).to.equal('');
});
it('should return an empty string if the error is a number', function() {
it('should return an empty string if the error is a number', function () {
const error = 0;
// @ts-ignore
expect(errors.getDescription(error)).to.equal('');
});
it('should return an empty string if the error is an array', function() {
it('should return an empty string if the error is an array', function () {
const error = [1, 2, 3];
// @ts-ignore
expect(errors.getDescription(error)).to.equal('');
});
it('should return an empty string if the error is undefined', function() {
it('should return an empty string if the error is undefined', function () {
const error = undefined;
// @ts-ignore
expect(errors.getDescription(error)).to.equal('');
});
it('should return an empty string if the error is null', function() {
it('should return an empty string if the error is null', function () {
const error = null;
// @ts-ignore
expect(errors.getDescription(error)).to.equal('');
});
it('should return an empty string if the error is an empty object', function() {
it('should return an empty string if the error is an empty object', function () {
const error = {};
// @ts-ignore
expect(errors.getDescription(error)).to.equal('');
});
it('should understand an error-like object with a description', function() {
it('should understand an error-like object with a description', function () {
const error = {
description: 'My description',
};
@ -279,7 +279,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal('My description');
});
it('should understand an error-like object with a stack', function() {
it('should understand an error-like object with a stack', function () {
const error = {
stack: 'My stack',
};
@ -288,7 +288,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal('My stack');
});
it('should understand an error-like object with a description and a stack', function() {
it('should understand an error-like object with a description and a stack', function () {
const error = {
description: 'My description',
stack: 'My stack',
@ -298,7 +298,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal('My description');
});
it('should stringify and beautify an object without any known property', function() {
it('should stringify and beautify an object without any known property', function () {
const error = {
name: 'John Doe',
job: 'Developer',
@ -310,33 +310,33 @@ describe('Shared: Errors', function() {
);
});
it('should return the stack for a basic error', function() {
it('should return the stack for a basic error', function () {
const error = new Error('Foo');
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should prefer a description property to a stack', function() {
it('should prefer a description property to a stack', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = 'My description';
expect(errors.getDescription(error)).to.equal('My description');
});
it('should return the stack if the description is an empty string', function() {
it('should return the stack if the description is an empty string', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = '';
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should return the stack if the description is a blank string', function() {
it('should return the stack if the description is a blank string', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = ' ';
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should get a generic description for ENOENT', function() {
it('should get a generic description for ENOENT', function () {
const error = new Error('Foo');
// @ts-ignore
error.code = 'ENOENT';
@ -345,7 +345,7 @@ describe('Shared: Errors', function() {
);
});
it('should get a generic description for EPERM', function() {
it('should get a generic description for EPERM', function () {
const error = new Error('Foo');
// @ts-ignore
error.code = 'EPERM';
@ -354,7 +354,7 @@ describe('Shared: Errors', function() {
);
});
it('should get a generic description for EACCES', function() {
it('should get a generic description for EACCES', function () {
const error = new Error('Foo');
// @ts-ignore
error.code = 'EACCES';
@ -363,7 +363,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(message);
});
it('should get a generic description for ENOMEM', function() {
it('should get a generic description for ENOMEM', function () {
const error = new Error('Foo');
// @ts-ignore
error.code = 'ENOMEM';
@ -372,7 +372,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(message);
});
it('should prefer a description property than a code description', function() {
it('should prefer a description property than a code description', function () {
const error = new Error('Foo');
// @ts-ignore
error.code = 'ENOMEM';
@ -381,8 +381,8 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal('Memory error');
});
describe('given userFriendlyDescriptionsOnly is false', function() {
it('should return the stack for a basic error', function() {
describe('given userFriendlyDescriptionsOnly is false', function () {
it('should return the stack for a basic error', function () {
const error = new Error('Foo');
expect(
errors.getDescription(error, {
@ -391,7 +391,7 @@ describe('Shared: Errors', function() {
).to.equal(error.stack);
});
it('should return the stack if the description is an empty string', function() {
it('should return the stack if the description is an empty string', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = '';
@ -402,7 +402,7 @@ describe('Shared: Errors', function() {
).to.equal(error.stack);
});
it('should return the stack if the description is a blank string', function() {
it('should return the stack if the description is a blank string', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = ' ';
@ -414,8 +414,8 @@ describe('Shared: Errors', function() {
});
});
describe('given userFriendlyDescriptionsOnly is true', function() {
it('should return an empty string for a basic error', function() {
describe('given userFriendlyDescriptionsOnly is true', function () {
it('should return an empty string for a basic error', function () {
const error = new Error('Foo');
expect(
errors.getDescription(error, {
@ -424,7 +424,7 @@ describe('Shared: Errors', function() {
).to.equal('');
});
it('should return an empty string if the description is an empty string', function() {
it('should return an empty string if the description is an empty string', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = '';
@ -435,7 +435,7 @@ describe('Shared: Errors', function() {
).to.equal('');
});
it('should return an empty string if the description is a blank string', function() {
it('should return an empty string if the description is a blank string', function () {
const error = new Error('Foo');
// @ts-ignore
error.description = ' ';
@ -448,8 +448,8 @@ describe('Shared: Errors', function() {
});
});
describe('.createError()', function() {
it('should not be a user error', function() {
describe('.createError()', function () {
it('should not be a user error', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -458,7 +458,7 @@ describe('Shared: Errors', function() {
expect(errors.isUserError(error)).to.be.false;
});
it('should be a user error if `options.report` is false', function() {
it('should be a user error if `options.report` is false', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -468,7 +468,7 @@ describe('Shared: Errors', function() {
expect(errors.isUserError(error)).to.be.true;
});
it('should be a user error if `options.report` evaluates to false', function() {
it('should be a user error if `options.report` evaluates to false', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -479,7 +479,7 @@ describe('Shared: Errors', function() {
expect(errors.isUserError(error)).to.be.true;
});
it('should not be a user error if `options.report` is true', function() {
it('should not be a user error if `options.report` is true', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -489,7 +489,7 @@ describe('Shared: Errors', function() {
expect(errors.isUserError(error)).to.be.false;
});
it('should not be a user error if `options.report` evaluates to true', function() {
it('should not be a user error if `options.report` evaluates to true', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -500,7 +500,7 @@ describe('Shared: Errors', function() {
expect(errors.isUserError(error)).to.be.false;
});
it('should be an instance of Error', function() {
it('should be an instance of Error', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -509,7 +509,7 @@ describe('Shared: Errors', function() {
expect(error).to.be.an.instanceof(Error);
});
it('should correctly add both a title and a description', function() {
it('should correctly add both a title and a description', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -519,7 +519,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal('Something happened');
});
it('should correctly add a code', function() {
it('should correctly add a code', function () {
const error = errors.createError({
title: 'Foo',
description: 'Something happened',
@ -529,7 +529,7 @@ describe('Shared: Errors', function() {
expect(error.code).to.equal('HELLO');
});
it('should correctly add only a title', function() {
it('should correctly add only a title', function () {
const error = errors.createError({
title: 'Foo',
});
@ -538,7 +538,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should ignore an empty description', function() {
it('should ignore an empty description', function () {
const error = errors.createError({
title: 'Foo',
description: '',
@ -547,7 +547,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should ignore a blank description', function() {
it('should ignore a blank description', function () {
const error = errors.createError({
title: 'Foo',
description: ' ',
@ -556,14 +556,14 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should throw if no title', function() {
it('should throw if no title', function () {
expect(() => {
// @ts-ignore
errors.createError({});
}).to.throw('Invalid error title: undefined');
});
it('should throw if there is a description but no title', function() {
it('should throw if there is a description but no title', function () {
expect(() => {
// @ts-ignore
errors.createError({
@ -572,7 +572,7 @@ describe('Shared: Errors', function() {
}).to.throw('Invalid error title: undefined');
});
it('should throw if title is empty', function() {
it('should throw if title is empty', function () {
expect(() => {
errors.createError({
title: '',
@ -580,7 +580,7 @@ describe('Shared: Errors', function() {
}).to.throw('Invalid error title: ');
});
it('should throw if title is blank', function() {
it('should throw if title is blank', function () {
expect(() => {
errors.createError({
title: ' ',
@ -589,8 +589,8 @@ describe('Shared: Errors', function() {
});
});
describe('.createUserError()', function() {
it('should be a user error', function() {
describe('.createUserError()', function () {
it('should be a user error', function () {
const error = errors.createUserError({
title: 'Foo',
description: 'Something happened',
@ -599,7 +599,7 @@ describe('Shared: Errors', function() {
expect(errors.isUserError(error)).to.be.true;
});
it('should be an instance of Error', function() {
it('should be an instance of Error', function () {
const error = errors.createUserError({
title: 'Foo',
description: 'Something happened',
@ -608,7 +608,7 @@ describe('Shared: Errors', function() {
expect(error).to.be.an.instanceof(Error);
});
it('should correctly add both a title and a description', function() {
it('should correctly add both a title and a description', function () {
const error = errors.createUserError({
title: 'Foo',
description: 'Something happened',
@ -618,7 +618,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal('Something happened');
});
it('should correctly add only a title', function() {
it('should correctly add only a title', function () {
// @ts-ignore
const error = errors.createUserError({
title: 'Foo',
@ -628,7 +628,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should correctly add a code', function() {
it('should correctly add a code', function () {
// @ts-ignore
const error = errors.createUserError({
title: 'Foo',
@ -639,7 +639,7 @@ describe('Shared: Errors', function() {
expect(error.code).to.equal('HELLO');
});
it('should ignore an empty description', function() {
it('should ignore an empty description', function () {
const error = errors.createUserError({
title: 'Foo',
description: '',
@ -648,7 +648,7 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should ignore a blank description', function() {
it('should ignore a blank description', function () {
const error = errors.createUserError({
title: 'Foo',
description: ' ',
@ -657,14 +657,14 @@ describe('Shared: Errors', function() {
expect(errors.getDescription(error)).to.equal(error.stack);
});
it('should throw if no title', function() {
it('should throw if no title', function () {
expect(() => {
// @ts-ignore
errors.createUserError({});
}).to.throw('Invalid error title: undefined');
});
it('should throw if title is empty', function() {
it('should throw if title is empty', function () {
expect(() => {
// @ts-ignore
errors.createUserError({
@ -673,7 +673,7 @@ describe('Shared: Errors', function() {
}).to.throw('Invalid error title: ');
});
it('should throw if there is a description but no title', function() {
it('should throw if there is a description but no title', function () {
expect(() => {
// @ts-ignore
errors.createUserError({
@ -682,7 +682,7 @@ describe('Shared: Errors', function() {
}).to.throw('Invalid error title: undefined');
});
it('should throw if title is blank', function() {
it('should throw if title is blank', function () {
expect(() => {
// @ts-ignore
errors.createUserError({
@ -692,9 +692,9 @@ describe('Shared: Errors', function() {
});
});
describe('.isUserError()', function() {
_.each([0, '', false], value => {
it(`should return true if report equals ${value}`, function() {
describe('.isUserError()', function () {
_.each([0, '', false], (value) => {
it(`should return true if report equals ${value}`, function () {
const error = new Error('foo bar');
// @ts-ignore
error.report = value;
@ -702,8 +702,8 @@ describe('Shared: Errors', function() {
});
});
_.each([undefined, null, true, 1, 3, 'foo'], value => {
it(`should return false if report equals ${value}`, function() {
_.each([undefined, null, true, 1, 3, 'foo'], (value) => {
it(`should return false if report equals ${value}`, function () {
const error = new Error('foo bar');
// @ts-ignore
error.report = value;
@ -712,8 +712,8 @@ describe('Shared: Errors', function() {
});
});
describe('.toJSON()', function() {
it('should convert a simple error', function() {
describe('.toJSON()', function () {
it('should convert a simple error', function () {
const error = new Error('My error');
expect(errors.toJSON(error)).to.deep.equal({
code: undefined,
@ -730,7 +730,7 @@ describe('Shared: Errors', function() {
});
});
it('should convert an error with a description', function() {
it('should convert an error with a description', function () {
const error = new Error('My error');
// @ts-ignore
error.description = 'My description';
@ -750,7 +750,7 @@ describe('Shared: Errors', function() {
});
});
it('should convert an error with a code', function() {
it('should convert an error with a code', function () {
const error = new Error('My error');
// @ts-ignore
error.code = 'ENOENT';
@ -770,7 +770,7 @@ describe('Shared: Errors', function() {
});
});
it('should convert an error with a description and a code', function() {
it('should convert an error with a description and a code', function () {
const error = new Error('My error');
// @ts-ignore
error.description = 'My description';
@ -792,7 +792,7 @@ describe('Shared: Errors', function() {
});
});
it('should convert an error with a report value', function() {
it('should convert an error with a report value', function () {
const error = new Error('My error');
// @ts-ignore
error.report = true;
@ -812,7 +812,7 @@ describe('Shared: Errors', function() {
});
});
it('should convert an error without a message', function() {
it('should convert an error without a message', function () {
const error = new Error();
expect(errors.toJSON(error)).to.deep.equal({
@ -831,14 +831,14 @@ describe('Shared: Errors', function() {
});
});
describe('.fromJSON()', function() {
it('should return an Error object', function() {
describe('.fromJSON()', function () {
it('should return an Error object', function () {
const error = new Error('My error');
const result = errors.fromJSON(errors.toJSON(error));
expect(result).to.be.an.instanceof(Error);
});
it('should convert a simple JSON error', function() {
it('should convert a simple JSON error', function () {
const error = new Error('My error');
const result = errors.fromJSON(errors.toJSON(error));
@ -852,7 +852,7 @@ describe('Shared: Errors', function() {
expect(result.report).to.equal(error.report);
});
it('should convert a JSON error with a description', function() {
it('should convert a JSON error with a description', function () {
const error = new Error('My error');
// @ts-ignore
error.description = 'My description';
@ -868,7 +868,7 @@ describe('Shared: Errors', function() {
expect(result.report).to.equal(error.report);
});
it('should convert a JSON error with a code', function() {
it('should convert a JSON error with a code', function () {
const error = new Error('My error');
// @ts-ignore
error.code = 'ENOENT';
@ -884,7 +884,7 @@ describe('Shared: Errors', function() {
expect(result.report).to.equal(error.report);
});
it('should convert a JSON error with a report value', function() {
it('should convert a JSON error with a report value', function () {
const error = new Error('My error');
// @ts-ignore
error.report = false;

View File

@ -19,8 +19,8 @@ import * as _ from 'lodash';
import * as fileExtensions from '../../lib/shared/file-extensions';
describe('Shared: fileExtensions', function() {
describe('.getFileExtensions()', function() {
describe('Shared: fileExtensions', function () {
describe('.getFileExtensions()', function () {
_.forEach(
[
// No extension
@ -83,8 +83,8 @@ describe('Shared: fileExtensions', function() {
extensions: ['dmg'],
},
],
testCase => {
it(`should return ${testCase.extensions} for ${testCase.file}`, function() {
(testCase) => {
it(`should return ${testCase.extensions} for ${testCase.file}`, function () {
expect(fileExtensions.getFileExtensions(testCase.file)).to.deep.equal(
testCase.extensions,
);
@ -92,7 +92,7 @@ describe('Shared: fileExtensions', function() {
},
);
it('should always return lowercase extensions', function() {
it('should always return lowercase extensions', function () {
const filePath = 'foo.IMG.gZ';
expect(fileExtensions.getFileExtensions(filePath)).to.deep.equal([
'img',
@ -101,44 +101,44 @@ describe('Shared: fileExtensions', function() {
});
});
describe('.getLastFileExtension()', function() {
it('should return undefined if the file path has no extension', function() {
describe('.getLastFileExtension()', function () {
it('should return undefined if the file path has no extension', function () {
expect(fileExtensions.getLastFileExtension('foo')).to.equal(null);
});
it('should return the extension if there is only one extension', function() {
it('should return the extension if there is only one extension', function () {
expect(fileExtensions.getLastFileExtension('foo.img')).to.equal('img');
});
it('should return the last extension if there are two extensions', function() {
it('should return the last extension if there are two extensions', function () {
expect(fileExtensions.getLastFileExtension('foo.img.gz')).to.equal('gz');
});
it('should return the last extension if there are three extensions', function() {
it('should return the last extension if there are three extensions', function () {
expect(fileExtensions.getLastFileExtension('foo.bar.img.gz')).to.equal(
'gz',
);
});
});
describe('.getPenultimateFileExtension()', function() {
it('should return undefined in the file path has no extension', function() {
describe('.getPenultimateFileExtension()', function () {
it('should return undefined in the file path has no extension', function () {
expect(fileExtensions.getPenultimateFileExtension('foo')).to.equal(null);
});
it('should return undefined if there is only one extension', function() {
it('should return undefined if there is only one extension', function () {
expect(fileExtensions.getPenultimateFileExtension('foo.img')).to.equal(
null,
);
});
it('should return the penultimate extension if there are two extensions', function() {
it('should return the penultimate extension if there are two extensions', function () {
expect(fileExtensions.getPenultimateFileExtension('foo.img.gz')).to.equal(
'img',
);
});
it('should return the penultimate extension if there are three extensions', function() {
it('should return the penultimate extension if there are three extensions', function () {
expect(
fileExtensions.getPenultimateFileExtension('foo.bar.img.gz'),
).to.equal('img');

View File

@ -19,8 +19,8 @@ import * as _ from 'lodash';
import * as messages from '../../lib/shared/messages';
describe('Shared: Messages', function() {
beforeEach(function() {
describe('Shared: Messages', function () {
beforeEach(function () {
this.drives = [
{
description: 'My Drive',
@ -33,19 +33,19 @@ describe('Shared: Messages', function() {
];
});
it('should contain object properties', function() {
it('should contain object properties', function () {
expect(_.every(_.map(messages, _.isPlainObject))).to.be.true;
});
it('should contain function properties in each category', function() {
_.each(messages, category => {
it('should contain function properties in each category', function () {
_.each(messages, (category) => {
expect(_.every(_.map(category, _.isFunction))).to.be.true;
});
});
describe('.info', function() {
describe('.flashComplete()', function() {
it('should use singular when there are single results', function() {
describe('.info', function () {
describe('.flashComplete()', function () {
it('should use singular when there are single results', function () {
const msg = messages.info.flashComplete('image.img', this.drives, {
failed: 1,
successful: 1,
@ -56,7 +56,7 @@ describe('Shared: Messages', function() {
);
});
it('should use plural when there are multiple results', function() {
it('should use plural when there are multiple results', function () {
const msg = messages.info.flashComplete('image.img', this.drives, {
failed: 2,
successful: 2,
@ -67,7 +67,7 @@ describe('Shared: Messages', function() {
);
});
it('should not contain failed target part when there are none', function() {
it('should not contain failed target part when there are none', function () {
const msg = messages.info.flashComplete('image.img', this.drives, {
failed: 0,
successful: 2,
@ -76,7 +76,7 @@ describe('Shared: Messages', function() {
expect(msg).to.equal('image.img was successfully flashed to 2 targets');
});
it('should show drive name and description when only target', function() {
it('should show drive name and description when only target', function () {
const msg = messages.info.flashComplete('image.img', this.drives, {
failed: 0,
successful: 1,
@ -89,9 +89,9 @@ describe('Shared: Messages', function() {
});
});
describe('.error', function() {
describe('.flashFailure()', function() {
it('should use plural when there are multiple drives', function() {
describe('.error', function () {
describe('.flashFailure()', function () {
it('should use plural when there are multiple drives', function () {
const msg = messages.error.flashFailure('image.img', this.drives);
expect(msg).to.equal(
@ -99,7 +99,7 @@ describe('Shared: Messages', function() {
);
});
it('should use singular when there is one drive', function() {
it('should use singular when there is one drive', function () {
const msg = messages.error.flashFailure('image.img', [this.drives[0]]);
expect(msg).to.equal(

View File

@ -20,19 +20,19 @@ import { stub } from 'sinon';
import * as permissions from '../../lib/shared/permissions';
describe('Shared: permissions', function() {
describe('.createLaunchScript()', function() {
describe('given windows', function() {
beforeEach(function() {
describe('Shared: permissions', function () {
describe('.createLaunchScript()', function () {
describe('given windows', function () {
beforeEach(function () {
this.osPlatformStub = stub(os, 'platform');
this.osPlatformStub.returns('win32');
});
afterEach(function() {
afterEach(function () {
this.osPlatformStub.restore();
});
it('should escape environment variables and arguments', function() {
it('should escape environment variables and arguments', function () {
expect(
permissions.createLaunchScript(
'C:\\Users\\Alice & Bob\'s Laptop\\"what"\\balenaEtcher',
@ -54,17 +54,17 @@ describe('Shared: permissions', function() {
});
for (const platform of ['linux', 'darwin']) {
describe(`given ${platform}`, function() {
beforeEach(function() {
describe(`given ${platform}`, function () {
beforeEach(function () {
this.osPlatformStub = stub(os, 'platform');
this.osPlatformStub.returns(platform);
});
afterEach(function() {
afterEach(function () {
this.osPlatformStub.restore();
});
it('should escape environment variables and arguments', function() {
it('should escape environment variables and arguments', function () {
expect(
permissions.createLaunchScript(
'/home/Alice & Bob\'s Laptop/"what"/balenaEtcher',

View File

@ -19,16 +19,16 @@ import * as _ from 'lodash';
import * as supportedFormats from '../../lib/shared/supported-formats';
describe('Shared: SupportedFormats', function() {
describe('.getCompressedExtensions()', function() {
it('should return the supported compressed extensions', function() {
describe('Shared: SupportedFormats', function () {
describe('.getCompressedExtensions()', function () {
it('should return the supported compressed extensions', function () {
const extensions = supportedFormats.getCompressedExtensions().sort();
expect(extensions).to.deep.equal(['bz2', 'gz', 'xz'].sort());
});
});
describe('.getNonCompressedExtensions()', function() {
it('should return the supported non compressed extensions', function() {
describe('.getNonCompressedExtensions()', function () {
it('should return the supported non compressed extensions', function () {
const extensions = supportedFormats.getNonCompressedExtensions();
expect(extensions).to.deep.equal([
'img',
@ -45,15 +45,15 @@ describe('Shared: SupportedFormats', function() {
});
});
describe('.getArchiveExtensions()', function() {
it('should return the supported archive extensions', function() {
describe('.getArchiveExtensions()', function () {
it('should return the supported archive extensions', function () {
const extensions = supportedFormats.getArchiveExtensions();
expect(extensions).to.deep.equal(['zip', 'etch']);
});
});
describe('.getAllExtensions()', function() {
it('should return the union of all compressed, uncompressed, and archive extensions', function() {
describe('.getAllExtensions()', function () {
it('should return the union of all compressed, uncompressed, and archive extensions', function () {
const archiveExtensions = supportedFormats.getArchiveExtensions();
const compressedExtensions = supportedFormats.getCompressedExtensions();
const nonCompressedExtensions = supportedFormats.getNonCompressedExtensions();
@ -67,7 +67,7 @@ describe('Shared: SupportedFormats', function() {
});
});
describe('.isSupportedImage()', function() {
describe('.isSupportedImage()', function () {
_.forEach(
[
// Type: 'archive'
@ -89,25 +89,25 @@ describe('Shared: SupportedFormats', function() {
'path/to/filename.sdcard',
'path/to/filename.wic',
],
filename => {
it(`should return true for ${filename}`, function() {
(filename) => {
it(`should return true for ${filename}`, function () {
const isSupported = supportedFormats.isSupportedImage(filename);
expect(isSupported).to.be.true;
});
},
);
it('should return false if the file has no extension', function() {
it('should return false if the file has no extension', function () {
const isSupported = supportedFormats.isSupportedImage('/path/to/foo');
expect(isSupported).to.be.false;
});
it('should return false if the extension is not included in .getAllExtensions()', function() {
it('should return false if the extension is not included in .getAllExtensions()', function () {
const isSupported = supportedFormats.isSupportedImage('/path/to/foo.jpg');
expect(isSupported).to.be.false;
});
it('should return true if the extension is included in .getAllExtensions()', function() {
it('should return true if the extension is included in .getAllExtensions()', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -116,7 +116,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should ignore casing when determining extension validity', function() {
it('should ignore casing when determining extension validity', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -125,7 +125,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should not consider an extension before a non compressed extension', function() {
it('should not consider an extension before a non compressed extension', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -134,7 +134,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should return true if the extension is supported and the file name includes dots', function() {
it('should return true if the extension is supported and the file name includes dots', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -143,14 +143,14 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should return true if the extension is only a supported archive extension', function() {
it('should return true if the extension is only a supported archive extension', function () {
const archiveExtension = _.first(supportedFormats.getArchiveExtensions());
const imagePath = `/path/to/foo.${archiveExtension}`;
const isSupported = supportedFormats.isSupportedImage(imagePath);
expect(isSupported).to.be.true;
});
it('should return true if the extension is a supported one plus a supported compressed extensions', function() {
it('should return true if the extension is a supported one plus a supported compressed extensions', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -162,7 +162,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should return false if the extension is an unsupported one plus a supported compressed extensions', function() {
it('should return false if the extension is an unsupported one plus a supported compressed extensions', function () {
const compressedExtension = _.first(
supportedFormats.getCompressedExtensions(),
);
@ -171,17 +171,17 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.false;
});
it('should return false if the file has no extension', function() {
it('should return false if the file has no extension', function () {
const isSupported = supportedFormats.isSupportedImage('/path/to/foo');
expect(isSupported).to.be.false;
});
it('should return false if the extension is not included in .getAllExtensions()', function() {
it('should return false if the extension is not included in .getAllExtensions()', function () {
const isSupported = supportedFormats.isSupportedImage('/path/to/foo.jpg');
expect(isSupported).to.be.false;
});
it('should return true if the extension is included in .getAllExtensions()', function() {
it('should return true if the extension is included in .getAllExtensions()', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -190,7 +190,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should ignore casing when determining extension validity', function() {
it('should ignore casing when determining extension validity', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -199,7 +199,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should not consider an extension before a non compressed extension', function() {
it('should not consider an extension before a non compressed extension', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -208,7 +208,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should return true if the extension is supported and the file name includes dots', function() {
it('should return true if the extension is supported and the file name includes dots', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -217,14 +217,14 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should return true if the extension is only a supported archive extension', function() {
it('should return true if the extension is only a supported archive extension', function () {
const archiveExtension = _.first(supportedFormats.getArchiveExtensions());
const imagePath = `/path/to/foo.${archiveExtension}`;
const isSupported = supportedFormats.isSupportedImage(imagePath);
expect(isSupported).to.be.true;
});
it('should return true if the extension is a supported one plus a supported compressed extensions', function() {
it('should return true if the extension is a supported one plus a supported compressed extensions', function () {
const nonCompressedExtension = _.first(
supportedFormats.getNonCompressedExtensions(),
);
@ -236,7 +236,7 @@ describe('Shared: SupportedFormats', function() {
expect(isSupported).to.be.true;
});
it('should return false if the extension is an unsupported one plus a supported compressed extensions', function() {
it('should return false if the extension is an unsupported one plus a supported compressed extensions', function () {
const compressedExtension = _.first(
supportedFormats.getCompressedExtensions(),
);
@ -246,7 +246,7 @@ describe('Shared: SupportedFormats', function() {
});
});
describe('.looksLikeWindowsImage()', function() {
describe('.looksLikeWindowsImage()', function () {
_.each(
[
'C:\\path\\to\\en_windows_10_multiple_editions_version_1607_updated_jan_2017_x64_dvd_9714399.iso',
@ -254,8 +254,8 @@ describe('Shared: SupportedFormats', function() {
'/path/to/Win10_1607_SingleLang_English_x32.iso',
'/path/to/en_winxp_pro_x86_build2600_iso.img',
],
imagePath => {
it(`should return true if filename is ${imagePath}`, function() {
(imagePath) => {
it(`should return true if filename is ${imagePath}`, function () {
const looksLikeWindowsImage = supportedFormats.looksLikeWindowsImage(
imagePath,
);
@ -269,8 +269,8 @@ describe('Shared: SupportedFormats', function() {
'C:\\path\\to\\2017-01-11-raspbian-jessie.img',
'/path/to/2017-01-11-raspbian-jessie.img',
],
imagePath => {
it(`should return false if filename is ${imagePath}`, function() {
(imagePath) => {
it(`should return false if filename is ${imagePath}`, function () {
const looksLikeWindowsImage = supportedFormats.looksLikeWindowsImage(
imagePath,
);

View File

@ -17,41 +17,41 @@
import { expect } from 'chai';
import * as units from '../../lib/shared/units';
describe('Shared: Units', function() {
describe('.bytesToClosestUnit()', function() {
it('should convert bytes to terabytes', function() {
describe('Shared: Units', function () {
describe('.bytesToClosestUnit()', function () {
it('should convert bytes to terabytes', function () {
expect(units.bytesToClosestUnit(1000000000000)).to.equal('1 TB');
expect(units.bytesToClosestUnit(2987801405440)).to.equal('2.99 TB');
expect(units.bytesToClosestUnit(999900000000000)).to.equal('1000 TB');
});
it('should convert bytes to gigabytes', function() {
it('should convert bytes to gigabytes', function () {
expect(units.bytesToClosestUnit(1000000000)).to.equal('1 GB');
expect(units.bytesToClosestUnit(7801405440)).to.equal('7.8 GB');
expect(units.bytesToClosestUnit(999900000000)).to.equal('1000 GB');
});
it('should convert bytes to megabytes', function() {
it('should convert bytes to megabytes', function () {
expect(units.bytesToClosestUnit(1000000)).to.equal('1 MB');
expect(units.bytesToClosestUnit(801405440)).to.equal('801 MB');
expect(units.bytesToClosestUnit(999900000)).to.equal('1000 MB');
});
it('should convert bytes to kilobytes', function() {
it('should convert bytes to kilobytes', function () {
expect(units.bytesToClosestUnit(1000)).to.equal('1 kB');
expect(units.bytesToClosestUnit(5440)).to.equal('5.44 kB');
expect(units.bytesToClosestUnit(999900)).to.equal('1000 kB');
});
it('should keep bytes as bytes', function() {
it('should keep bytes as bytes', function () {
expect(units.bytesToClosestUnit(1)).to.equal('1 B');
expect(units.bytesToClosestUnit(8)).to.equal('8 B');
expect(units.bytesToClosestUnit(999)).to.equal('999 B');
});
});
describe('.bytesToMegabytes()', function() {
it('should convert bytes to megabytes', function() {
describe('.bytesToMegabytes()', function () {
it('should convert bytes to megabytes', function () {
expect(units.bytesToMegabytes(1.2e7)).to.equal(12);
expect(units.bytesToMegabytes(332000)).to.equal(0.332);
});

View File

@ -18,108 +18,108 @@ import { expect } from 'chai';
import * as utils from '../../lib/shared/utils';
describe('Shared: Utils', function() {
describe('.isValidPercentage()', function() {
it('should return false if percentage is not a number', function() {
describe('Shared: Utils', function () {
describe('.isValidPercentage()', function () {
it('should return false if percentage is not a number', function () {
expect(utils.isValidPercentage('50')).to.be.false;
});
it('should return false if percentage is null', function() {
it('should return false if percentage is null', function () {
expect(utils.isValidPercentage(null)).to.be.false;
});
it('should return false if percentage is undefined', function() {
it('should return false if percentage is undefined', function () {
expect(utils.isValidPercentage(undefined)).to.be.false;
});
it('should return false if percentage is an integer less than 0', function() {
it('should return false if percentage is an integer less than 0', function () {
expect(utils.isValidPercentage(-1)).to.be.false;
});
it('should return false if percentage is a float less than 0', function() {
it('should return false if percentage is a float less than 0', function () {
expect(utils.isValidPercentage(-0.1)).to.be.false;
});
it('should return true if percentage is 0', function() {
it('should return true if percentage is 0', function () {
expect(utils.isValidPercentage(0)).to.be.true;
});
it('should return true if percentage is an integer greater than 0, but less than 100', function() {
it('should return true if percentage is an integer greater than 0, but less than 100', function () {
expect(utils.isValidPercentage(50)).to.be.true;
});
it('should return true if percentage is a float greater than 0, but less than 100', function() {
it('should return true if percentage is a float greater than 0, but less than 100', function () {
expect(utils.isValidPercentage(49.55)).to.be.true;
});
it('should return true if percentage is 100', function() {
it('should return true if percentage is 100', function () {
expect(utils.isValidPercentage(100)).to.be.true;
});
it('should return false if percentage is an integer greater than 100', function() {
it('should return false if percentage is an integer greater than 100', function () {
expect(utils.isValidPercentage(101)).to.be.false;
});
it('should return false if percentage is a float greater than 100', function() {
it('should return false if percentage is a float greater than 100', function () {
expect(utils.isValidPercentage(100.001)).to.be.false;
});
});
describe('.percentageToFloat()', function() {
it('should throw an error if given a string percentage', function() {
expect(function() {
describe('.percentageToFloat()', function () {
it('should throw an error if given a string percentage', function () {
expect(function () {
utils.percentageToFloat('50');
}).to.throw('Invalid percentage: 50');
});
it('should throw an error if given a null percentage', function() {
expect(function() {
it('should throw an error if given a null percentage', function () {
expect(function () {
utils.percentageToFloat(null);
}).to.throw('Invalid percentage: null');
});
it('should throw an error if given an undefined percentage', function() {
expect(function() {
it('should throw an error if given an undefined percentage', function () {
expect(function () {
utils.percentageToFloat(undefined);
}).to.throw('Invalid percentage: undefined');
});
it('should throw an error if given an integer percentage < 0', function() {
expect(function() {
it('should throw an error if given an integer percentage < 0', function () {
expect(function () {
utils.percentageToFloat(-1);
}).to.throw('Invalid percentage: -1');
});
it('should throw an error if given a float percentage < 0', function() {
expect(function() {
it('should throw an error if given a float percentage < 0', function () {
expect(function () {
utils.percentageToFloat(-0.1);
}).to.throw('Invalid percentage: -0.1');
});
it('should covert a 0 percentage to 0', function() {
it('should covert a 0 percentage to 0', function () {
expect(utils.percentageToFloat(0)).to.equal(0);
});
it('should covert an integer percentage to a float', function() {
it('should covert an integer percentage to a float', function () {
expect(utils.percentageToFloat(50)).to.equal(0.5);
});
it('should covert an float percentage to a float', function() {
it('should covert an float percentage to a float', function () {
expect(utils.percentageToFloat(46.54)).to.equal(0.4654);
});
it('should covert a 100 percentage to 1', function() {
it('should covert a 100 percentage to 1', function () {
expect(utils.percentageToFloat(100)).to.equal(1);
});
it('should throw an error if given an integer percentage > 100', function() {
expect(function() {
it('should throw an error if given an integer percentage > 100', function () {
expect(function () {
utils.percentageToFloat(101);
}).to.throw('Invalid percentage: 101');
});
it('should throw an error if given a float percentage > 100', function() {
expect(function() {
it('should throw an error if given a float percentage > 100', function () {
expect(function () {
utils.percentageToFloat(100.01);
}).to.throw('Invalid percentage: 100.01');
});

View File

@ -26,13 +26,13 @@ if (!entrypoint) {
process.exit(EXIT_CODES.GENERAL_ERROR);
}
describe('Spectron', function() {
describe('Spectron', function () {
// Mainly for CI jobs
this.timeout(40000);
let app: Application;
before('app:start', function() {
before('app:start', function () {
app = new Application({
path: entrypoint,
args: ['--no-sandbox', '.'],
@ -41,7 +41,7 @@ describe('Spectron', function() {
return app.start();
});
after('app:stop', function() {
after('app:stop', function () {
if (app && app.isRunning()) {
return app.stop();
}
@ -49,12 +49,12 @@ describe('Spectron', function() {
return Promise.resolve();
});
describe('Browser Window', function() {
it('should open a browser window', async function() {
describe('Browser Window', function () {
it('should open a browser window', async function () {
return expect(await app.browserWindow.isVisible()).to.be.true;
});
it('should set a proper title', async function() {
it('should set a proper title', async function () {
// @ts-ignore (SpectronClient.getTitle exists)
return expect(await app.client.getTitle()).to.equal('Etcher');
});