Skip to content

Commit

Permalink
Merge pull request #123 from Financial-Times/@maxcbc/linting
Browse files Browse the repository at this point in the history
Fix eslint problems
  • Loading branch information
Max Clark authored Aug 7, 2019
2 parents eb4aa1b + a100586 commit 02a6821
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 141 deletions.
14 changes: 7 additions & 7 deletions bin/n-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ program
.description('')
.action(function (app) {

if(app && app.toUpperCase().startsWith('HALP')) {
halp();
} else {
// eslint-disable-next-line no-console
console.error(`The command ${app} is not known`);
process.exit(1);
}
if(app && app.toUpperCase().startsWith('HALP')) {
halp();
} else {
// eslint-disable-next-line no-console
console.error(`The command ${app} is not known`);
process.exit(1);
}
});


Expand Down
14 changes: 7 additions & 7 deletions lib/checks/elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = async (testPage) => {
//eslint randomly started failing this, even though it is guarded!
//eslint-disable-next-line guard-for-in
for(const selector in testPage.check.elements) {
if(testPage.check.elements.hasOwnProperty(selector)) {
if(testPage.check.elements.hasOwnProperty(selector)) {
const assertion = testPage.check.elements[selector];
//If we're expecting an element, wait for it.

Expand All @@ -30,12 +30,12 @@ module.exports = async (testPage) => {
});
} else if (typeof assertion === 'string') {

const elText = await testPage.getElementText(selector);
results.push({
expected: `element with selector selector ${selector} should contain text ${assertion}`,
actual: elText,
result: elText.includes(assertion)
});
const elText = await testPage.getElementText(selector);
results.push({
expected: `element with selector selector ${selector} should contain text ${assertion}`,
actual: elText,
result: elText.includes(assertion)
});
}
};

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/jank-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = [{
}
}
}
}
}
}];
8 changes: 4 additions & 4 deletions test/fixtures/smoke-custom-check.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = [{
urls: {
'/status/200': {
custom: 20
}
urls: {
'/status/200': {
custom: 20
}
}
}
];
12 changes: 6 additions & 6 deletions test/fixtures/smoke-error-fail.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

module.exports = [{
urls: {
'/status/200?1': { status: 200, https: true }, //These three will fail because the test server doesn't support https
'/status/200?2': { status: 200, https: true },
'/status/200?3': { status: 200, https: true },
'/status/200?4': { status: 200, https: false }
}
urls: {
'/status/200?1': { status: 200, https: true }, //These three will fail because the test server doesn't support https
'/status/200?2': { status: 200, https: true },
'/status/200?3': { status: 200, https: true },
'/status/200?4': { status: 200, https: false }
}
}

];
12 changes: 6 additions & 6 deletions test/fixtures/smoke-error-pass.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module.exports = [{
urls: {
'/status/200?1': { status: 200, https: true }, //These two will fail because the test server doesn't support https
'/status/200?2': { status: 200, https: true },
'/status/200?3': { status: 200, https: false },
'/status/200?4': { status: 200, https: false },
}
urls: {
'/status/200?1': { status: 200, https: true }, //These two will fail because the test server doesn't support https
'/status/200?2': { status: 200, https: true },
'/status/200?3': { status: 200, https: false },
'/status/200?4': { status: 200, https: false },
}
}
];
50 changes: 25 additions & 25 deletions test/fixtures/smoke-fail.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
const assert = require('assert');

module.exports = [{
urls: {
'/status/503': 200,
'/status/404': {
status: 404
},
'/coverage/bad': {
cssCoverage: {
'coverage/bad': 50
}
},
'/coverage/okay': {
cssCoverage: {
'coverage/okay': 60
}
},
'/jank': {
elementShifts: {
'.content': {
maxCount: 0
}
}
},
'/json': {
content: (body) => {
assert.equal(body.key, 'wrong-value');
urls: {
'/status/503': 200,
'/status/404': {
status: 404
},
'/coverage/bad': {
cssCoverage: {
'coverage/bad': 50
}
},
'/coverage/okay': {
cssCoverage: {
'coverage/okay': 60
}
},
'/jank': {
elementShifts: {
'.content': {
maxCount: 0
}
}
},
'/json': {
content: (body) => {
assert.equal(body.key, 'wrong-value');
}
}
}
}

];
134 changes: 67 additions & 67 deletions test/fixtures/smoke-pass.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
module.exports = [{
urls: {
'/status/200': 200,
'/status/204': 204, // this will be skipped because we don't support it yet!
'/status/404': {
status: 404,
content: '404',
responseHeaders: {
'X-Powered-By': 'Express'
}
},
'/status/302': 302,
'/redirect': '/status/200',
'/post': {
method: 'POST',
body: 'stuff',
status: 200,
content: (content) => {
return content.includes('stuff');
}
},
'/json' : {
content: (content) => JSON.parse(content).key === 'value'
},
'/network-requests': {
waitUntil: 'load',
networkRequests: {
'/status/200': 1,
'/status': 2,
'/status/2': true,
'/json': false
}
},
'/coverage/good': {
waitUntil: 'load',
elements: {
'.one': 1,
'.two': 1,
'div': 3,
'.does-not-exist': 0,
'.no-content': false
},
cssCoverage: {
'coverage/good': 50
}
},
'/coverage/okay': {
waitUntil: 'load',
elements: {
'.one': true,
'.three': 0
},
cssCoverage: {
'coverage/okay': 50
}
urls: {
'/status/200': 200,
'/status/204': 204, // this will be skipped because we don't support it yet!
'/status/404': {
status: 404,
content: '404',
responseHeaders: {
'X-Powered-By': 'Express'
}
},
'/status/302': 302,
'/redirect': '/status/200',
'/post': {
method: 'POST',
body: 'stuff',
status: 200,
content: (content) => {
return content.includes('stuff');
}
},
'/json' : {
content: (content) => JSON.parse(content).key === 'value'
},
'/network-requests': {
waitUntil: 'load',
networkRequests: {
'/status/200': 1,
'/status': 2,
'/status/2': true,
'/json': false
}
},
'/coverage/good': {
waitUntil: 'load',
elements: {
'.one': 1,
'.two': 1,
'div': 3,
'.does-not-exist': 0,
'.no-content': false
},
'/no-jank': {
elementShifts: {
'.content': {
maxCount: 0,
maxPixels: 0
}
}
cssCoverage: {
'coverage/good': 50
}
},
'/coverage/okay': {
waitUntil: 'load',
elements: {
'.one': true,
'.three': 0
},
'/actions': {
actions: [
'click element .my-button'
],
elements: {
'.content': true
cssCoverage: {
'coverage/okay': 50
}
},
'/no-jank': {
elementShifts: {
'.content': {
maxCount: 0,
maxPixels: 0
}
}
},
'/actions': {
actions: [
'click element .my-button'
],
elements: {
'.content': true
}
}
}
}];
2 changes: 1 addition & 1 deletion test/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ app.post('/post', (req, res) => {
body += chunk.toString();
});
req.on('end', () => {
; res.send('GOT: ' + body);
; res.send('GOT: ' + body);
});
});

Expand Down
34 changes: 17 additions & 17 deletions test/tasks/smoke.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ describe('Smoke Tests of the Smoke', () => {
config: 'test/fixtures/smoke-pass.js'
});
return smoke.run()
.then((results) => {
expect(results.passed.length).toEqual(12);
expect(results.failed.length).toEqual(0);
expect(results.errors.length).toEqual(0);
done();
});
.then((results) => {
expect(results.passed.length).toEqual(12);
expect(results.failed.length).toEqual(0);
expect(results.errors.length).toEqual(0);
done();
});
}, 10000);

test('tests should fail if some tests fail', (done) => {
Expand All @@ -35,12 +35,12 @@ describe('Smoke Tests of the Smoke', () => {
config: 'test/fixtures/smoke-fail.js'
});
return smoke.run()
.catch((results) => {
expect(results.passed.length).toEqual(1);
expect(results.failed.length).toEqual(5);
expect(results.errors.length).toEqual(0);
done();
});
.catch((results) => {
expect(results.passed.length).toEqual(1);
expect(results.failed.length).toEqual(5);
expect(results.errors.length).toEqual(0);
done();
});
}, 10000);

});
Expand Down Expand Up @@ -83,11 +83,11 @@ describe('Smoke Tests of the Smoke', () => {
};
});
return smoke.run()
.then((results) => {
expect(results.passed.length).toEqual(1);
expect(results.failed.length).toEqual(0);
done();
});
.then((results) => {
expect(results.passed.length).toEqual(1);
expect(results.failed.length).toEqual(0);
done();
});
});

});
Expand Down

0 comments on commit 02a6821

Please sign in to comment.