forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinternal-spec.ts
22 lines (21 loc) · 1.01 KB
/
internal-spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { expect } from 'chai'
describe('feature-string parsing', () => {
it('is indifferent to whitespace around keys and values', () => {
const parseFeaturesString = require('../lib/common/parse-features-string')
const checkParse = (string: string, parsed: Record<string, string | boolean>) => {
const features: Record<string, string | boolean> = {}
parseFeaturesString(string, (k: string, v: any) => { features[k] = v })
expect(features).to.deep.equal(parsed)
}
checkParse('a=yes,c=d', { a: true, c: 'd' })
checkParse('a=yes ,c=d', { a: true, c: 'd' })
checkParse('a=yes, c=d', { a: true, c: 'd' })
checkParse('a=yes , c=d', { a: true, c: 'd' })
checkParse(' a=yes , c=d', { a: true, c: 'd' })
checkParse(' a= yes , c=d', { a: true, c: 'd' })
checkParse(' a = yes , c=d', { a: true, c: 'd' })
checkParse(' a = yes , c =d', { a: true, c: 'd' })
checkParse(' a = yes , c = d', { a: true, c: 'd' })
checkParse(' a = yes , c = d ', { a: true, c: 'd' })
})
})