Skip to content

Commit

Permalink
REname class export and test
Browse files Browse the repository at this point in the history
 🐿 v2.6.0
  • Loading branch information
adgad committed Feb 14, 2018
1 parent 68597cf commit 78beaac
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ module.exports = [
**Using programatically**

```
const SmokeTests = require('@financial-times/n-test').SmokeTests;
const SmokeTest = require('@financial-times/n-test').SmokeTest;
const smoke = new SmokeTests({ headers: { globalHeader: true }, host: 'local.ft.com:3002' });
//Add custom checks like so:
Expand All @@ -97,11 +97,11 @@ smoke.addCheck('custom', async (testPage) => {
}
});
nTest.smoke.runf
smoke.run()
.then((results) => { //all passed })
.catch((results) => { //some failed });
nTest.smoke.run({}, ['basic']);
smoke.run(['basic']);
```

#### Open
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
smoke: require('./lib/smoke')
SmokeTest: require('./lib/smoke')
};
2 changes: 2 additions & 0 deletions lib/smoke/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const verifyCacheHeaders = require('./verify-cache-headers');
module.exports = {
status: (testPage) => {
if (testPage.check.status === 204) {
//eslint-disable-next-line no-console
console.info('204 status checks are not supported yet!');
return { expected: 204, actual: '¯\_(ツ)_/¯ ', result: true };
return true;
Expand All @@ -18,6 +19,7 @@ module.exports = {
},

pageErrors: (testPage) => {
//eslint-disable-next-line no-console
console.debug('Errors on page: ' + testPage.pageErrors);
return {
expected: `no more than ${testPage.check.pageErrors} console errors`,
Expand Down
2 changes: 0 additions & 2 deletions tasks/smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ const SmokeTests = require('../lib/smoke');

module.exports = (program) => {



program
.command('smoke [sets...]')
.option('-a, --auth', 'Authenticate with FT_NEXT_BACKEND_KEY')
Expand Down
14 changes: 7 additions & 7 deletions test/tasks/smoke.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*globals beforeAll, expect */

const server = require('../server/app');
const SmokeTests = require('../../lib/smoke');
const SmokeTest = require('../../lib/smoke');

describe('Smoke Tests of the Smoke', () => {

Expand All @@ -12,7 +12,7 @@ describe('Smoke Tests of the Smoke', () => {

describe('status checks', () => {
test('tests should pass if all the urls return the correct status', (done) => {
const smoke = new SmokeTests({
const smoke = new SmokeTest({
host: 'http://localhost:3004',
config: 'test/fixtures/smoke-status-pass.js'
});
Expand All @@ -26,7 +26,7 @@ describe('Smoke Tests of the Smoke', () => {

test('tests should fail if some urls return the incorrect status code', (done) => {

const smoke = new SmokeTests({
const smoke = new SmokeTest({
host: 'http://localhost:3004',
config: 'test/fixtures/smoke-status-fail.js'
});
Expand All @@ -42,7 +42,7 @@ describe('Smoke Tests of the Smoke', () => {
describe('CSS coverage', () => {
test('tests should pass if CSS is well covered',(done) => {

const smoke = new SmokeTests({
const smoke = new SmokeTest({
host: 'http://localhost:3004',
config: 'test/fixtures/smoke-coverage-pass.js'
});
Expand All @@ -57,7 +57,7 @@ describe('Smoke Tests of the Smoke', () => {

test('tests should fail if CSS coverage is below threshold', (done) => {

const smoke = new SmokeTests({
const smoke = new SmokeTest({
host: 'http://localhost:3004',
config: 'test/fixtures/smoke-coverage-fail.js'
});
Expand All @@ -73,7 +73,7 @@ describe('Smoke Tests of the Smoke', () => {
describe('Adding custom checks', () => {
test('should allow adding custom assertions',(done) => {

const smoke = new SmokeTests({
const smoke = new SmokeTest({
host: 'http://localhost:3004',
config: 'test/fixtures/smoke-custom-check.js'
});
Expand All @@ -85,7 +85,7 @@ describe('Smoke Tests of the Smoke', () => {
expected: `no more than ${testPage.check.custom} DOM nodes`,
actual: `${metrics.Nodes} nodes`,
result: testPage.check.custom >= metrics.Nodes
}
};
});
return smoke.run()
.then((results) => {
Expand Down

0 comments on commit 78beaac

Please sign in to comment.