aboutsummaryrefslogtreecommitdiff
path: root/test/shared
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-01-11 20:14:56 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-01-11 20:14:56 +0900
commitbefcff973aa0fd9b0f3a73932a39d36e9eb85bf2 (patch)
treef4361ce9dc0401384335529ec4f90870b7bcec63 /test/shared
parentdda4e7475cdd092d00441c7cd0ceb194ee5dee3d (diff)
fix property parser
Diffstat (limited to 'test/shared')
-rw-r--r--test/shared/commands/parsers.test.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/shared/commands/parsers.test.js b/test/shared/commands/parsers.test.js
index 200323c..0a1960c 100644
--- a/test/shared/commands/parsers.test.js
+++ b/test/shared/commands/parsers.test.js
@@ -9,6 +9,12 @@ describe("shared/commands/parsers", () => {
expect(value).to.equal('utf-8');
});
+ it('parse set empty string', () => {
+ let [key, value] = parsers.parseSetOption('encoding=', { encoding: 'string' });
+ expect(key).to.equal('encoding');
+ expect(value).to.equal('');
+ });
+
it('parse set string', () => {
let [key, value] = parsers.parseSetOption('history=50', { history: 'number' });
expect(key).to.equal('history');
@@ -34,6 +40,7 @@ describe("shared/commands/parsers", () => {
it('throws error on invalid property', () => {
expect(() => parsers.parseSetOption('charset=utf-8', { charset: 'number' })).to.throw(Error, 'Not number');
expect(() => parsers.parseSetOption('charset=utf-8', { charset: 'boolean' })).to.throw(Error, 'Invalid');
+ expect(() => parsers.parseSetOption('charset=', { charset: 'boolean' })).to.throw(Error, 'Invalid');
expect(() => parsers.parseSetOption('smoothscroll', { smoothscroll: 'string' })).to.throw(Error, 'Invalid');
expect(() => parsers.parseSetOption('smoothscroll', { smoothscroll: 'number' })).to.throw(Error, 'Invalid');
})