mirror of
https://github.com/upgundecha/howtheysre
synced 2026-01-03 15:58:03 +00:00
Added sort test and switch to chai expect
This commit is contained in:
@@ -1,18 +1,36 @@
|
||||
const fs = require('fs');
|
||||
const { assert } = require('chai');
|
||||
const chai = require('chai');
|
||||
|
||||
chai.use(require('chai-arrays'));
|
||||
chai.use(require('chai-string'));
|
||||
|
||||
var expect = chai.expect;
|
||||
|
||||
const srcMd = fs.readFileSync('README.md', 'utf8');
|
||||
|
||||
describe('Header', function() {
|
||||
it('Starts with #', function() {
|
||||
assert.isOk(srcMd.startsWith('# How they SRE'), 'Header is broken');
|
||||
expect(srcMd).to. startsWith('# How they SRE');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sections', function() {
|
||||
['Introduction', 'Organizations', 'Resources', 'Credits', 'Other How They... repos', 'Contribute', 'License'] .forEach(function (section) {
|
||||
['Introduction',
|
||||
'Organizations',
|
||||
'Resources',
|
||||
'Credits',
|
||||
'Other How They... repos',
|
||||
'Contribute',
|
||||
'License'].forEach(function (section) {
|
||||
it(`${section}`, function() {
|
||||
assert.isOk(srcMd.includes(`## ${section}`), `${section} section is missing`);
|
||||
expect(srcMd).to.contain(`## ${section}`);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Order', function() {
|
||||
it('Organization list is sorted', function() {
|
||||
var list = srcMd.match(/(?<=<summary>)(.*?)(?=<\/summary>)/g);
|
||||
expect(list).to.be.sorted(Intl.Collator().compare);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user