diff --git a/src/routes/test/provision-test.js b/src/routes/test/provision-test.js index db8e90d64..43df3a01f 100644 --- a/src/routes/test/provision-test.js +++ b/src/routes/test/provision-test.js @@ -216,20 +216,20 @@ describe('Provision', function () { expect(response.body.token).to.be.a('string'); }); - it('fails the second time', async function () { + it('activate fails the second time', async function () { const response = await superagent.post(`${serverUrl}/api/v1/provision/activate`) .send({ username: owner.username, password: owner.password, email: owner.email, displayName: owner.displayName }) .ok(() => true); - expect(response.statusCode).to.eql(409); + expect(response.statusCode).to.eql(405); // route unavailable post activation }); - it('after fails', async function () { + it('seutp fails after activation', async function () { const response = await superagent.post(`${serverUrl}/api/v1/provision/setup`) .send({ domainConfig: { provider: 'noop', domain: DOMAIN, adminFqdn: 'my.' + DOMAIN, config: {}, tlsConfig: { provider: 'fallback' } } }) .ok(() => true); - expect(response.statusCode).to.eql(409); + expect(response.statusCode).to.eql(405); }); it('device left first time mode', async function () { diff --git a/src/routes/test/system-test.js b/src/routes/test/system-test.js index a37486293..5391ba07e 100644 --- a/src/routes/test/system-test.js +++ b/src/routes/test/system-test.js @@ -127,17 +127,6 @@ describe('System', function () { }); }); - describe('disks', function () { - it('succeeds', async function () { - const response = await superagent.get(`${serverUrl}/api/v1/system/disks`) - .query({ access_token: owner.token }); - - expect(response.statusCode).to.equal(200); - expect(response.body.disks).to.be.ok(); - expect(Object.keys(response.body.disks).some(fs => response.body.disks[fs].mountpoint === '/')).to.be(true); - }); - }); - describe('disk usage', function () { it('get succeeds with no cache', async function () { safe.fs.unlinkSync(paths.DISK_USAGE_FILE); diff --git a/src/tasks.js b/src/tasks.js index ed9ccc848..f13eb18cd 100644 --- a/src/tasks.js +++ b/src/tasks.js @@ -115,9 +115,8 @@ async function update(id, task) { debug(`update ${id}: ${JSON.stringify(task)}`); - let args = [ ]; - let fields = [ ]; - for (let k in task) { + const args = [], fields = []; + for (const k in task) { if (k === 'result' || k === 'error') { fields.push(`${k}Json = ?`); args.push(JSON.stringify(task[k])); @@ -244,7 +243,7 @@ async function listByTypePaged(type, page, perPage) { assert.strictEqual(typeof page, 'number'); assert.strictEqual(typeof perPage, 'number'); - let data = []; + const data = []; let query = `SELECT ${TASKS_FIELDS} FROM tasks`; if (type) { diff --git a/src/taskworker.js b/src/taskworker.js index 5d1f73c41..ee7c6f0fc 100755 --- a/src/taskworker.js +++ b/src/taskworker.js @@ -32,8 +32,8 @@ const TASKS = { // indexed by task type syncDyndns: dyndns.sync, updateDiskUsage: system.updateDiskUsage, - _identity: async (arg, progressCallback) => { progressCallback(); return arg; }, - _error: async (arg, progressCallback) => { progressCallback(); throw new Error(`Failed for arg: ${arg}`); }, + _identity: async (arg, progressCallback) => { progressCallback({}); return arg; }, + _error: async (arg, progressCallback) => { progressCallback({}); throw new Error(`Failed for arg: ${arg}`); }, _crash: (arg) => { throw new Error(`Crashing for arg: ${arg}`); }, // the test looks for this debug string in the log file _sleep: async (arg) => setTimeout(process.exit, arg) };