diff --git a/app.js b/app.js index 5d98231..fd05909 100644 --- a/app.js +++ b/app.js @@ -20,7 +20,6 @@ const {MongoClient} = require('mongodb'); module.exports = initApp; -// Initialise the application function initApp(config, callback) { const app = { diff --git a/model/result.js b/model/result.js index bda1438..1a3e5bc 100644 --- a/model/result.js +++ b/model/result.js @@ -45,7 +45,7 @@ module.exports = function(app, callback) { }); }, - // Default filter options + _defaultFilterOpts(opts) { const now = Date.now(); const thirtyDaysAgo = now - (1000 * 60 * 60 * 24 * 30); @@ -57,7 +57,7 @@ module.exports = function(app, callback) { }; }, - // Get results + _getFiltered(opts) { opts = model._defaultFilterOpts(opts); const filter = { @@ -84,13 +84,11 @@ module.exports = function(app, callback) { }); }, - // Get results for all tasks getAll(opts) { delete opts.task; return model._getFiltered(opts); }, - // Get a result by ID getById(id, full) { const prepare = (full ? model.prepareForFullOutput : model.prepareForOutput); try { @@ -112,13 +110,11 @@ module.exports = function(app, callback) { }); }, - // Get results for a single task getByTaskId(id, opts) { opts.task = id; return model._getFiltered(opts); }, - // Delete results for a single task deleteByTaskId(id) { try { id = new ObjectID(id); @@ -134,7 +130,6 @@ module.exports = function(app, callback) { }); }, - // Get a result by ID and task ID getByIdAndTaskId(id, task, opts) { const prepare = (opts.full ? model.prepareForFullOutput : model.prepareForOutput); @@ -162,7 +157,6 @@ module.exports = function(app, callback) { }); }, - // Prepare a result for output prepareForOutput(result) { result = model.prepareForFullOutput(result); delete result.results; diff --git a/model/task.js b/model/task.js index 2664abc..ced2946 100644 --- a/model/task.js +++ b/model/task.js @@ -21,7 +21,6 @@ const {grey} = require('kleur'); const {ObjectID} = require('mongodb'); const pa11y = require('pa11y'); -// Task model module.exports = function(app, callback) { app.db.collection('tasks', async (errors, collection) => { await collection.createIndex({ @@ -33,7 +32,6 @@ module.exports = function(app, callback) { collection, - // Create a task create: function(newTask) { newTask.headers = model.sanitizeHeaderInput(newTask.headers); @@ -47,7 +45,6 @@ module.exports = function(app, callback) { }); }, - // Get all tasks getAll: () => { return collection .find() @@ -66,7 +63,6 @@ module.exports = function(app, callback) { }); }, - // Get a task by ID getById: id => { try { id = new ObjectID(id); @@ -86,7 +82,6 @@ module.exports = function(app, callback) { }); }, - // Edit a task by ID editById: function(id, edits) { const idString = id; try { @@ -136,7 +131,6 @@ module.exports = function(app, callback) { }); }, - // Add an annotation to a task addAnnotationById: function(id, annotation) { return model.getById(id) .then(task => { @@ -156,7 +150,6 @@ module.exports = function(app, callback) { }); }, - // Delete a task by ID deleteById: function(id) { try { id = new ObjectID(id); @@ -175,7 +168,6 @@ module.exports = function(app, callback) { }); }, - // Run a task by ID runById: function(id) { return model.getById(id).then(async task => { const pa11yOptions = { @@ -223,7 +215,6 @@ module.exports = function(app, callback) { }); }, - // Prepare a task for output prepareForOutput: function(task) { if (!task) { return null; diff --git a/task/pa11y.js b/task/pa11y.js index 042c9f1..76a5cb1 100644 --- a/task/pa11y.js +++ b/task/pa11y.js @@ -21,7 +21,6 @@ const {CronJob} = require('cron'); module.exports = initTask; exports.runPa11yOnTasks = runPa11yOnTasks; -// Initialise the task function initTask(config, app) { if (!config.cron) { config.cron = '0 30 0 * * *'; // 00:30 daily @@ -30,7 +29,6 @@ function initTask(config, app) { job.start(); } -// Runs the task async function taskRunner(app) { console.log(''); console.log(grey('Starting to run task @ %s'), new Date()); @@ -45,7 +43,6 @@ async function taskRunner(app) { } } -// Runs an array of pa11y tasks function runPa11yOnTasks(tasks, app) { if (tasks.length === 0) { console.log('No pa11y tasks to run'); diff --git a/test/.eslintrc.js b/test/.eslintrc.js index 2044729..48688a2 100644 --- a/test/.eslintrc.js +++ b/test/.eslintrc.js @@ -1,6 +1,5 @@ 'use strict'; -// Clone the main config const config = module.exports = JSON.parse(JSON.stringify(require('../.eslintrc'))); // We use `this` all over the integration tests diff --git a/test/integration/helper/navigate.js b/test/integration/helper/navigate.js index 4946022..662f487 100644 --- a/test/integration/helper/navigate.js +++ b/test/integration/helper/navigate.js @@ -18,7 +18,6 @@ const request = require('request'); module.exports = createNavigator; -// Create a navigate function function createNavigator(baseUrl, store) { return function(opts, callback) { diff --git a/test/integration/setup.js b/test/integration/setup.js index cb9063d..39388ee 100644 --- a/test/integration/setup.js +++ b/test/integration/setup.js @@ -22,7 +22,6 @@ const request = require('request'); const errorCodeForNoService = 2; -// Run before all tests before(function(done) { this.baseUrl = `http://0.0.0.0:${config.port}/`; this.app = null; @@ -38,12 +37,10 @@ before(function(done) { }); }); -// Run after each test afterEach(done => { loadFixtures('test', config, done); }); -// Check that the test application is running, and exit if not function assertTestAppIsRunning(baseUrl, done) { request(baseUrl, error => { if (error) {