blob: c61e991ff11fd5a516f23fd6bf37859e3d571750 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
import iniParse from './iniParse'
const iniExample = `
[Options]
name = Matt
showname = Matty
[Emotions]
number = 9
1 = Normal#-#normal#0#1
`
describe('iniParse', () => {
test('should not lowercase value if key is showname', () => {
const ini = iniParse(`
[test]
showname = MATT
`)
expect(ini.test.showname).toBe('MATT')
})
test('should lowercase value if key is not showname', () => {
const ini = iniParse(`
[test]
party = TIME
`)
expect(ini.test.party).toBe('time')
})
test('should parse sections', () => {
const parsedIni = iniParse(iniExample)
expect(Object.keys(parsedIni).length).toBe(2);
});
test('should parse parameters', () => {
const parsedIni = iniParse(iniExample)
expect(Object.keys(parsedIni.options).length).toBe(2);
})
})
|