diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 11:58:34 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 12:17:58 +0900 |
commit | 2d0968a70b78710e854075d96a8e643e2cd2b3a7 (patch) | |
tree | d15d54b340cb461378627db035e6410c253b1052 /test | |
parent | 61806a4e7ff01e8b5fdfdcef0308a2c41fc98778 (diff) |
add setting validator
Diffstat (limited to 'test')
-rw-r--r-- | test/shared/validators/setting.test.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/shared/validators/setting.test.js b/test/shared/validators/setting.test.js new file mode 100644 index 0000000..8bf0cbe --- /dev/null +++ b/test/shared/validators/setting.test.js @@ -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'); + }); + }); +}); |