diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 12:25:49 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 12:25:49 +0900 |
commit | 1b2554adee528da1078ad39694a3f8264c639821 (patch) | |
tree | 0fcacdad33a51cf7611af77e601443eb827c2498 /test/shared/validators/setting.test.js | |
parent | 709fa95aa383b75e88fb12512f772ea55d757b06 (diff) | |
parent | 8c9051076f7782b898ab2f848b9afe4a694c3065 (diff) |
Merge branch 'settings-validation'
Diffstat (limited to 'test/shared/validators/setting.test.js')
-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'); + }); + }); +}); |