A fork of https://github.com/ueokande/vim-vixen
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.5 KiB
54 lines
1.5 KiB
import * as settings from '../../src/shared/Settings'; |
|
import {expect} from 'chai'; |
|
|
|
describe('Settings', () => { |
|
describe('#valueOf', () => { |
|
it('returns settings by valid settings', () => { |
|
let x = settings.valueOf({ |
|
keymaps: {}, |
|
"search": { |
|
"default": "google", |
|
"engines": { |
|
"google": "https://google.com/search?q={}", |
|
} |
|
}, |
|
"properties": {}, |
|
"blacklist": [] |
|
}); |
|
|
|
expect({ |
|
keymaps: x.keymaps.toJSON(), |
|
search: x.search.toJSON(), |
|
properties: x.properties.toJSON(), |
|
blacklist: x.blacklist.toJSON(), |
|
}).to.deep.equal({ |
|
keymaps: {}, |
|
search: { |
|
default: "google", |
|
engines: { |
|
google: "https://google.com/search?q={}", |
|
} |
|
}, |
|
properties: { |
|
hintchars: "abcdefghijklmnopqrstuvwxyz", |
|
smoothscroll: false, |
|
complete: "sbh" |
|
}, |
|
blacklist: [] |
|
}); |
|
}); |
|
|
|
it('sets default settings', () => { |
|
let value = settings.valueOf({}); |
|
expect(value.keymaps.toJSON()).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.toJSON()).to.be.empty; |
|
}); |
|
|
|
it('throws a TypeError with an unknown field', () => { |
|
expect(() => settings.valueOf({ name: 'alice' })).to.throw(TypeError) |
|
}); |
|
}); |
|
});
|
|
|