Total Complexity | 5 |
Complexity/F | 1 |
Lines of Code | 40 |
Function Count | 5 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
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 |