Passed
Push — master ( 527212...0fe9bd )
by Pieter Epeüs
02:47 queued 52s
created

src/__tests__/parser.unit.js   A

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 27
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 19
mnd 0
bc 0
fnc 2
dl 0
loc 27
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
/* eslint-disable no-new */
2
import { expect, describe, it } from '@jest/globals';
3
import Parser from '../parser';
4
5
const testSchema = {
6
    a: Number,
7
    b: Boolean,
8
    'c?': String,
9
};
10
11
describe('Test parser.js', () => {
12
    it('It should parse the values', () => {
13
        const input = {
14
            a: '42',
15
            b: '1',
16
            c: 42,
17
            d: 'test',
18
        };
19
        const parse = new Parser({ schema: testSchema });
20
21
        expect(parse.parseObject(input)).toEqual({
22
            a: 42,
23
            b: true,
24
            c: '42',
25
            d: 'test',
26
        });
27
    });
28
});
29