add setting validator
This commit is contained in:
parent
61806a4e7f
commit
2d0968a70b
2 changed files with 58 additions and 0 deletions
25
test/shared/validators/setting.test.js
Normal file
25
test/shared/validators/setting.test.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { expect } from "chai";
|
||||
import { validate } from '../../../src/shared/validators/setting';
|
||||
|
||||
describe("setting validator", () => {
|
||||
describe("unknown top keys", () => {
|
||||
it('throws an error for unknown settings', () => {
|
||||
let settings = { keymaps: {}, poison: 123 };
|
||||
let fn = validate.bind(undefined, settings)
|
||||
expect(fn).to.throw(Error, 'poison');
|
||||
})
|
||||
});
|
||||
|
||||
describe("keymaps settings", () => {
|
||||
it('throws an error for unknown operation', () => {
|
||||
let settings = {
|
||||
keymaps: {
|
||||
a: { 'type': 'scroll.home' },
|
||||
b: { 'type': 'poison.dressing' },
|
||||
}
|
||||
};
|
||||
let fn = validate.bind(undefined, settings)
|
||||
expect(fn).to.throw(Error, 'poison.dressing');
|
||||
});
|
||||
});
|
||||
});
|
Reference in a new issue