aboutsummaryrefslogtreecommitdiff
path: root/test/shared/validators
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-05-01 15:51:40 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-05-01 15:51:40 +0900
commit9da2f5fd786ff7ef64eca0a86efb1c0b9a164244 (patch)
treeb888349817d0016dc1499932671bbe6cd95efdaa /test/shared/validators
parentf9889b7f2b634bfe5a540633d8952f4a6f900658 (diff)
parent89d6afecfd257ff4fc62748f771abf37ef3a2852 (diff)
Merge remote-tracking branch 'origin/master' into patch-1
Diffstat (limited to 'test/shared/validators')
-rw-r--r--test/shared/validators/setting.test.js82
1 files changed, 0 insertions, 82 deletions
diff --git a/test/shared/validators/setting.test.js b/test/shared/validators/setting.test.js
deleted file mode 100644
index 15d6a10..0000000
--- a/test/shared/validators/setting.test.js
+++ /dev/null
@@ -1,82 +0,0 @@
-import { expect } from "chai";
-import { validate } from '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');
- });
- });
-
- describe("search settings", () => {
- it('throws an error for invalid search engine name', () => {
- let settings = {
- search: {
- default: 'google',
- engines: {
- 'google': 'https://google.com/search?q={}',
- 'cherry pie': 'https://cherypie.com/search?q={}',
- }
- }
- };
- let fn = validate.bind(undefined, settings)
- expect(fn).to.throw(Error, 'cherry pie');
- });
-
- it('throws an error for no {}-placeholder', () => {
- let settings = {
- search: {
- default: 'google',
- engines: {
- 'google': 'https://google.com/search?q={}',
- 'yahoo': 'https://search.yahoo.com/search',
- }
- }
- };
- let fn = validate.bind(undefined, settings)
- expect(fn).to.throw(Error, 'yahoo');
- });
-
- it('throws an error for no default engines', () => {
- let settings = {
- search: {
- engines: {
- 'google': 'https://google.com/search?q={}',
- 'yahoo': 'https://search.yahoo.com/search?q={}',
- }
- }
- };
- let fn = validate.bind(undefined, settings)
- expect(fn).to.throw(Error, 'Default engine');
- });
-
- it('throws an error for invalid default engine', () => {
- let settings = {
- search: {
- default: 'twitter',
- engines: {
- 'google': 'https://google.com/search?q={}',
- 'yahoo': 'https://search.yahoo.com/search?q={}',
- }
- }
- };
- let fn = validate.bind(undefined, settings)
- expect(fn).to.throw(Error, 'twitter');
- });
- });
-});