diff options
| author | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-06 19:00:38 -0500 |
|---|---|---|
| committer | caleb.mabry.15@cnu.edu <caleb.mabry.15@cnu.edu> | 2022-03-06 19:00:38 -0500 |
| commit | ecb0b9f85d5968bfc3d687b51944a47937f698fd (patch) | |
| tree | cd160d11c58c0c75c7101c841c611bc7a0150956 /webAO | |
| parent | 003862580fb809f0b0ef93f75d9dfea37de12e54 (diff) | |
Added unit testing and code coverage
Diffstat (limited to 'webAO')
| -rw-r--r-- | webAO/iniParse.test.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/webAO/iniParse.test.js b/webAO/iniParse.test.js new file mode 100644 index 0000000..c61e991 --- /dev/null +++ b/webAO/iniParse.test.js @@ -0,0 +1,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); + }) +}) + |
