mirror of
https://github.com/upgundecha/howtheysre
synced 2026-01-02 23:38:01 +00:00
Refactor tests
This commit is contained in:
@@ -8,29 +8,32 @@ var expect = chai.expect;
|
||||
|
||||
const srcMd = fs.readFileSync('README.md', 'utf8');
|
||||
|
||||
describe('Header', function() {
|
||||
it('Starts with #', function() {
|
||||
expect(srcMd).to. startsWith('# How they SRE');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Sections', function() {
|
||||
['Introduction',
|
||||
'Organizations',
|
||||
'Resources',
|
||||
'Credits',
|
||||
'Other How They... repos',
|
||||
'Contribute',
|
||||
'License'].forEach(function (section) {
|
||||
it(`${section}`, function() {
|
||||
expect(srcMd).to.contain(`## ${section}`);
|
||||
});
|
||||
describe('Header', function () {
|
||||
it('is intact', function () {
|
||||
expect(srcMd).to.startsWith('# How they SRE');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Order', function() {
|
||||
it('Organization list is sorted', function() {
|
||||
var list = srcMd.match(/(?<=<summary>)(.*?)(?=<\/summary>)/g);
|
||||
expect(list).to.be.sorted(Intl.Collator().compare);
|
||||
describe('Section Headers', function () {
|
||||
it('intact', function () {
|
||||
var expectedH2List = [
|
||||
'## Introduction',
|
||||
'## Organizations',
|
||||
'## SRECon Mix Playlist',
|
||||
'## Resources',
|
||||
'## Credits',
|
||||
'## Other How They... repos',
|
||||
'## Contribute',
|
||||
'## License'
|
||||
]
|
||||
var actualList = srcMd.match(/^## (.*$)/gim);
|
||||
expect(expectedH2List).to.equalTo(actualList)
|
||||
});
|
||||
});
|
||||
|
||||
describe('Organization list', function () {
|
||||
it('is sorted', function () {
|
||||
var orgList = srcMd.match(/(?<=<summary>)(.*?)(?=<\/summary>)/g);
|
||||
expect(orgList).to.be.sorted(Intl.Collator().compare);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user