remote-jobs/test/validation-ok.js
James Nylen 8942a91a85
Add automated tests for validation script (#438)
* Update node

* Add mocha and chai

* Fix npm audit issue

https://nodesecurity.io/advisories/577

* Skip some redundant errors

* Catch duplicate headings

* Update the wording of a few errors

* Detect when headings are wrapped inside another element

* Build and validate the content of each profile section

* Add tests for validation script

* Remove empty sections in existing profiles
2018-06-22 23:50:06 -05:00

29 lines
771 B
JavaScript

const { expect } = require( 'chai' );
const { runValidationWithFixtures } = require( './lib' );
describe( 'validation script', () => {
it( 'should pass with valid data', () => {
expect( runValidationWithFixtures( 'valid' ) ).to.eql( {
exitCode: 0,
output: [],
} );
} );
it( 'should pass with valid data and incomplete profiles, and count headings', () => {
const env = { REPORT_PROFILE_HEADINGS: 'y' };
expect( runValidationWithFixtures( 'valid-incomplete', env ) ).to.eql( {
exitCode: 0,
output: [
'Profile headings by count (7 total profiles):',
'Company blurb: 7',
'Company size: 4',
'Remote status: 4',
'Region: 4',
'Company technologies: 3',
'How to apply: 3',
'Office locations: 1',
],
} );
} );
} );