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

Complexity

Total Complexity 3
Complexity/F 1

Size

Lines of Code 18
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
mnd 0
bc 0
fnc 3
dl 0
loc 18
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: String,
6
};
7
const ObjectWithSchema = Obj({ schema });
8
9
describe('Test createAll', () => {
10
    it('It should create an object for all items', () => {
11
        const data = [{ sku: '123' }, { sku: '124' }];
12
        const result = ObjectWithSchema.createAll(data);
13
        expect(result).toEqual(data);
14
15
        const keys = result.map((item) => item.keys());
16
        expect(keys).toEqual([['sku'], ['sku']]);
17
    });
18
});
19