-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from github/smoke-tests
Smoke tests
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* globals describe, it*/ | ||
const config = require('../lib/index.js') | ||
const fs = require('fs') | ||
const assert = require('assert') | ||
const path = require('path') | ||
|
||
describe('smoke tests', () => { | ||
it('ensure all rules in lib/rules are included in index', () => { | ||
const exportedRules = new Set(Object.keys(config.rules)) | ||
const files = new Set(fs.readdirSync('./lib/rules').map(f => path.basename(f, path.extname(f)))) | ||
assert.deepEqual(files, exportedRules) | ||
}) | ||
|
||
it('exports every config in lib/config as .configs', () => { | ||
const exportedConfigs = new Set(Object.keys(config.configs)) | ||
const files = new Set(fs.readdirSync('./lib/configs').map(f => path.basename(f, path.extname(f)))) | ||
assert.deepEqual(files, exportedConfigs) | ||
}) | ||
|
||
it('exports valid rules in each config', () => { | ||
const exportedRules = new Set(Object.keys(config.rules)) | ||
for (const flavour in config.configs) { | ||
for (const rule in config.configs[flavour].rules) { | ||
if (rule.startsWith('github/')) { | ||
assert(exportedRules.has(rule.replace(/^github\//, '')), `rule ${rule} is not a valid rule`) | ||
} | ||
} | ||
} | ||
}) | ||
}) |