From a8f745f9fe74751b87f500af3857b66d4c80f45e Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 2 Jul 2018 18:49:33 -0400 Subject: eslint --fix . --- mascara/test/helpers.js | 6 +++--- mascara/test/index.js | 8 ++++---- mascara/test/util/mascara-test-helper.js | 9 +++++---- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'mascara/test') diff --git a/mascara/test/helpers.js b/mascara/test/helpers.js index eede103b4..08a0a9a7f 100644 --- a/mascara/test/helpers.js +++ b/mascara/test/helpers.js @@ -1,6 +1,6 @@ -function wait(time) { - return new Promise(function(resolve, reject) { - setTimeout(function() { +function wait (time) { + return new Promise(function (resolve, reject) { + setTimeout(function () { resolve() }, time * 3 || 1500) }) diff --git a/mascara/test/index.js b/mascara/test/index.js index 0134cdf00..d62e43705 100644 --- a/mascara/test/index.js +++ b/mascara/test/index.js @@ -1,9 +1,9 @@ var fs = require('fs') var path = require('path') -var browserify = require('browserify'); +var browserify = require('browserify') var tests = fs.readdirSync(path.join(__dirname, 'lib')) var bundlePath = path.join(__dirname, 'test-bundle.js') -var b = browserify(); +var b = browserify() // Remove old bundle try { @@ -14,9 +14,9 @@ try { var writeStream = fs.createWriteStream(bundlePath) -tests.forEach(function(fileName) { +tests.forEach(function (fileName) { b.add(path.join(__dirname, 'lib', fileName)) }) -b.bundle().pipe(writeStream); +b.bundle().pipe(writeStream) diff --git a/mascara/test/util/mascara-test-helper.js b/mascara/test/util/mascara-test-helper.js index 9cf4fa900..c40b57300 100644 --- a/mascara/test/util/mascara-test-helper.js +++ b/mascara/test/util/mascara-test-helper.js @@ -16,13 +16,14 @@ module.exports = class Helper extends EventEmitter { unregister () { return global.navigator.serviceWorker.getRegistration() .then((registration) => { - if (registration) return registration.unregister() + if (registration) { + return registration.unregister() .then((b) => b ? Promise.resolve() : Promise.reject()) - else return Promise.resolve() +} else return Promise.resolve() }) } clearDb () { - return new Promise ((resolve, reject) => { + return new Promise((resolve, reject) => { const deleteRequest = global.indexDB.deleteDatabase(KEY) deleteRequest.addEventListener('success', resolve) deleteRequest.addEventListener('error', reject) @@ -33,7 +34,7 @@ module.exports = class Helper extends EventEmitter { const db = new IDB({ version: 2, key: KEY, - initialState: state + initialState: state, }) return db.open() } -- cgit v1.2.3 From 03ff8a7cfa043539a58863aa7496c33167e815b1 Mon Sep 17 00:00:00 2001 From: brunobar79 Date: Mon, 2 Jul 2018 19:36:16 -0400 Subject: fix mascara warnings --- mascara/test/helpers.js | 2 +- mascara/test/test-ui.js | 2 -- mascara/test/util/mascara-test-helper.js | 9 +++++---- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'mascara/test') diff --git a/mascara/test/helpers.js b/mascara/test/helpers.js index 08a0a9a7f..8fc5c816b 100644 --- a/mascara/test/helpers.js +++ b/mascara/test/helpers.js @@ -1,4 +1,4 @@ -function wait (time) { +export default function wait (time) { return new Promise(function (resolve, reject) { setTimeout(function () { resolve() diff --git a/mascara/test/test-ui.js b/mascara/test/test-ui.js index b9bc42dff..16b2c206a 100644 --- a/mascara/test/test-ui.js +++ b/mascara/test/test-ui.js @@ -1,5 +1,3 @@ -const Helper = require('./util/mascara-test-helper.js') - window.addEventListener('load', () => { window.METAMASK_SKIP_RELOAD = true // inject app container diff --git a/mascara/test/util/mascara-test-helper.js b/mascara/test/util/mascara-test-helper.js index c40b57300..0439fbba3 100644 --- a/mascara/test/util/mascara-test-helper.js +++ b/mascara/test/util/mascara-test-helper.js @@ -2,15 +2,16 @@ const EventEmitter = require('events') const IDB = require('idb-global') const KEY = 'metamask-test-config' module.exports = class Helper extends EventEmitter { - constructor () { - super() - } tryToCleanContext () { this.unregister() .then(() => this.clearDb()) .then(() => super.emit('complete')) - .catch((err) => super.emit('complete')) + .catch((err) => { + if (err) { + super.emit('complete') + } + }) } unregister () { -- cgit v1.2.3