aboutsummaryrefslogtreecommitdiff
path: root/test/shared/validators/setting.test.js
blob: 8bf0cbee74d5d0d27d1fee91214454916c001126 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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');
    });
  });
});