test/base.test.js   A
last analyzed

Complexity

Total Complexity 5
Complexity/F 1

Size

Lines of Code 40
Function Count 5

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
nc 1
dl 0
loc 40
c 1
b 0
f 0
cc 0
rs 10
noi 0
wmc 5
mnd 0
bc 5
fnc 5
bpm 1
cpm 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A base.test.js ➔ ??? 0 6 1
1
"use strict";
2
const Base = require("../src/types/base");
3
4
test("test instantiation of Base", () => {
5
    const string = new Base();
6
7
    expect(string).toBeInstanceOf(Base);
8
    //expect(string.type).toBe("base");
9
});
10
11
test("test required()", () => {
12
    const string = new Base();
13
14
    expect(string.required()).toBe(string);
15
    expect(string.isRequired).toBeTruthy();
16
});
17
18
test("test min()", () => {
19
    const string = new Base();
20
21
    expect(string.min(5)).toBe(string);
22
    expect(string.minValue).toBe(5);
23
});
24
25
test("test max()", () => {
26
    const string = new Base();
27
28
    expect(string.max(10)).toBe(string);
29
    expect(string.maxValue).toBe(10);
30
});
31
32
test("test error()", () => {
33
    const string = new Base();
34
35
    expect(string.error("Any:required", "test")).toEqual({ error: {
36
        type: "Any:required",
37
        field: "test",
38
        message: "'test' is required and can't be omitted."
39
    }});
40
});
41