diff options
Diffstat (limited to 'test/shared')
-rw-r--r-- | test/shared/SettingData.test.ts | 15 | ||||
-rw-r--r-- | test/shared/Settings.test.ts | 31 | ||||
-rw-r--r-- | test/shared/properties.test.js | 18 | ||||
-rw-r--r-- | test/shared/property-defs.test.js | 18 | ||||
-rw-r--r-- | test/shared/settings/Properties.test.ts | 30 |
5 files changed, 41 insertions, 71 deletions
diff --git a/test/shared/SettingData.test.ts b/test/shared/SettingData.test.ts index f8995d9..b5bf70e 100644 --- a/test/shared/SettingData.test.ts +++ b/test/shared/SettingData.test.ts @@ -5,6 +5,7 @@ import Settings from '../../src/shared/Settings'; import { expect } from 'chai'; import Keymaps from '../../src/shared/settings/Keymaps'; import Search from '../../src/shared/settings/Search'; +import Properties from '../../src/shared/settings/Properties'; describe('shared/SettingData', () => { describe('FormKeymaps', () => { @@ -62,7 +63,7 @@ describe('shared/SettingData', () => { expect({ keymaps: settings.keymaps.toJSON(), search: settings.search.toJSON(), - properties: settings.properties, + properties: settings.properties.toJSON(), blacklist: settings.blacklist, }).to.deep.equal(JSON.parse(o)); }); @@ -78,11 +79,11 @@ describe('shared/SettingData', () => { google: "https://google.com/search?q={}", }, }), - properties: { + properties: Properties.fromJSON({ hintchars: "abcdefghijklmnopqrstuvwxyz", smoothscroll: false, complete: "sbh" - }, + }), blacklist: [], }; @@ -90,7 +91,7 @@ describe('shared/SettingData', () => { expect(JSON.parse(json)).to.deep.equal({ keymaps: o.keymaps.toJSON(), search: o.search.toJSON(), - properties: o.properties, + properties: o.properties.toJSON(), blacklist: o.blacklist, }); }); @@ -123,7 +124,7 @@ describe('shared/SettingData', () => { expect({ keymaps: settings.keymaps.toJSON(), search: settings.search.toJSON(), - properties: settings.properties, + properties: settings.properties.toJSON(), blacklist: settings.blacklist, }).to.deep.equal({ keymaps: { @@ -159,11 +160,11 @@ describe('shared/SettingData', () => { "google": "https://google.com/search?q={}" } }), - properties: { + properties: Properties.fromJSON({ hintchars: "abcdefghijklmnopqrstuvwxyz", smoothscroll: false, complete: "sbh" - }, + }), blacklist: [] }; diff --git a/test/shared/Settings.test.ts b/test/shared/Settings.test.ts index ed791a1..6360bab 100644 --- a/test/shared/Settings.test.ts +++ b/test/shared/Settings.test.ts @@ -1,33 +1,8 @@ import * as settings from '../../src/shared/Settings'; -import { expect } from 'chai'; +import {expect} from 'chai'; describe('Settings', () => { - describe('#propertiesValueOf', () => { - it('returns with default properties by empty settings', () => { - let props = settings.propertiesValueOf({}); - expect(props).to.deep.equal({ - hintchars: "abcdefghijklmnopqrstuvwxyz", - smoothscroll: false, - complete: "sbh" - }) - }); - - it('returns properties by valid settings', () => { - let props = settings.propertiesValueOf({ - hintchars: "abcdefgh", - smoothscroll: false, - complete: "sbh" - }); - - expect(props).to.deep.equal({ - hintchars: "abcdefgh", - smoothscroll: false, - complete: "sbh" - }); - }); - }); - describe('#blacklistValueOf', () => { it('returns empty array by empty settings', () => { let blacklist = settings.blacklistValueOf([]); @@ -70,7 +45,7 @@ describe('Settings', () => { expect({ keymaps: x.keymaps.toJSON(), search: x.search.toJSON(), - properties: x.properties, + properties: x.properties.toJSON(), blacklist: x.blacklist, }).to.deep.equal({ keymaps: {}, @@ -92,7 +67,7 @@ describe('Settings', () => { it('sets default settings', () => { let value = settings.valueOf({}); expect(value.keymaps.toJSON()).to.not.be.empty; - expect(value.properties).to.not.be.empty; + expect(value.properties.toJSON()).to.not.be.empty; expect(value.search.defaultEngine).to.be.a('string'); expect(value.search.engines).to.be.an('object'); expect(value.blacklist).to.be.empty; diff --git a/test/shared/properties.test.js b/test/shared/properties.test.js deleted file mode 100644 index 37903d8..0000000 --- a/test/shared/properties.test.js +++ /dev/null @@ -1,18 +0,0 @@ -import * as settings from 'shared/settings'; - -describe('properties', () => { - describe('Def class', () => { - it('returns property definitions', () => { - let def = new proerties.Def( - 'smoothscroll', - 'smooth scroll', - false); - - expect(def.name).to.equal('smoothscroll'); - expect(def.describe).to.equal('smooth scroll'); - expect(def.defaultValue).to.equal(false); - expect(def.type).to.equal('boolean'); - }); - }); -}); - diff --git a/test/shared/property-defs.test.js b/test/shared/property-defs.test.js deleted file mode 100644 index 37903d8..0000000 --- a/test/shared/property-defs.test.js +++ /dev/null @@ -1,18 +0,0 @@ -import * as settings from 'shared/settings'; - -describe('properties', () => { - describe('Def class', () => { - it('returns property definitions', () => { - let def = new proerties.Def( - 'smoothscroll', - 'smooth scroll', - false); - - expect(def.name).to.equal('smoothscroll'); - expect(def.describe).to.equal('smooth scroll'); - expect(def.defaultValue).to.equal(false); - expect(def.type).to.equal('boolean'); - }); - }); -}); - diff --git a/test/shared/settings/Properties.test.ts b/test/shared/settings/Properties.test.ts new file mode 100644 index 0000000..609a565 --- /dev/null +++ b/test/shared/settings/Properties.test.ts @@ -0,0 +1,30 @@ +import Properties from '../../../src/shared/settings/Properties'; +import { expect } from 'chai'; + +describe('Properties', () => { + describe('#propertiesValueOf', () => { + it('returns with default properties by empty settings', () => { + let props = Properties.fromJSON({}); + expect(props).to.deep.equal({ + hintchars: "abcdefghijklmnopqrstuvwxyz", + smoothscroll: false, + complete: "sbh" + }) + }); + + it('returns properties by valid settings', () => { + let props = Properties.fromJSON({ + hintchars: "abcdefgh", + smoothscroll: false, + complete: "sbh" + }); + + expect(props).to.deep.equal({ + hintchars: "abcdefgh", + smoothscroll: false, + complete: "sbh" + }); + }); + }); +}); + |