-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
374 additions
and
387 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
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
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
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
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
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
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
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
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
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
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
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { | ||
expect | ||
expect | ||
} from 'chai'; | ||
import calculateCellWidthIndex from './../src/calculateCellWidthIndex'; | ||
|
||
|
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
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
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 |
---|---|---|
@@ -1,43 +1,33 @@ | ||
import { | ||
expect | ||
expect | ||
} from 'chai'; | ||
import configSamples from './configSamples'; | ||
import validateConfig from '../dist/validateConfig'; | ||
import configSchema from '../src/schemas/config.json'; | ||
import Ajv from 'ajv'; | ||
import ajvKeywords from 'ajv-keywords'; | ||
import validateConfig from '../dist/validateConfig'; | ||
import configSchema from '../src/schemas/config.json'; | ||
import configSamples from './configSamples'; | ||
|
||
describe('config.json schema', () => { | ||
var validate; | ||
let validate; | ||
|
||
before(() => { | ||
var ajv = new Ajv({allErrors: true}); | ||
const ajv = new Ajv({allErrors: true}); | ||
|
||
ajvKeywords(ajv, 'typeof'); | ||
validate = ajv.compile(configSchema); | ||
}); | ||
|
||
it('should pass validation of valid config samples', () => { | ||
configSamples.valid.forEach((sample, i) => { | ||
testValid(sample, validate); | ||
testValid(sample, validateConfig); | ||
}); | ||
|
||
function testValid(sample, validate) { | ||
var valid = validate(sample); | ||
if (!valid) console.log(validate.errors); | ||
expect(valid).to.equal(true); | ||
it('passes validation of valid config samples', () => { | ||
for (const sample of configSamples.valid) { | ||
expect(validate(sample)).to.equal(true); | ||
expect(validateConfig(sample)).to.equal(true); | ||
} | ||
}); | ||
|
||
it('should fail validation of invalid config samples', () => { | ||
configSamples.invalid.forEach((sample, i) => { | ||
testInvalid(sample, validate); | ||
testInvalid(sample, validateConfig); | ||
}); | ||
|
||
function testInvalid(sample, validate) { | ||
var valid = validate(sample); | ||
expect(valid).to.equal(false); | ||
it('fails validation of invalid config samples', () => { | ||
for (const sample of configSamples.invalid) { | ||
expect(validate(sample)).to.equal(false); | ||
expect(validateConfig(sample)).to.equal(false); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.