src/__tests__/parse-all.spec.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 16
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 11
mnd 0
bc 0
fnc 2
dl 0
loc 16
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import { expect, describe, it } from '@jest/globals';
2
import Obj from '../objects.js';
3
4
const schema = {
5
    sku: Number,
6
};
7
const ObjectWithSchema = Obj({ schema });
8
9
describe('Test parseAll', () => {
10
    it('It should parse the object for all items', () => {
11
        const data = [{ sku: '123' }, { sku: '124' }];
12
        const result = ObjectWithSchema.parseAll(data);
13
        const expected = [{ sku: 123 }, { sku: 124 }];
14
        expect(result).toEqual(expected);
15
    });
16
});
17