Skip to content

Commit 81f6eb4

Browse files
authored
Merge pull request #29 from dreambo8563/release
test(TC for simple):
2 parents 98dc479 + f909eaa commit 81f6eb4

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

tests/unit/simple.spec.ts

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ describe("simple class", () => {
1515
const base = LazyBase.lazy(1).multiply(4);
1616
expect(base.value()).toBe(4);
1717
});
18+
1819
it("multiply - float", () => {
1920
const base = LazyBase.lazy(1.5).multiply(4);
2021
expect(base.value()).toBe(6);
@@ -55,20 +56,66 @@ describe("simple class", () => {
5556
.default("m");
5657
expect(base.value()).toBe(100);
5758
});
58-
it("precision - null", () => {
59+
60+
it("precision - without", () => {
5961
const base = LazyBase.lazy(1.5)
6062
.divide(1)
6163
.ceil()
6264
.default("m");
6365
expect(base.value()).toBe(2);
6466
});
67+
68+
it("precision - null", () => {
69+
const base = LazyBase.lazy(1.5)
70+
.divide(1)
71+
.ceil(null)
72+
.default("m");
73+
const base1 = LazyBase.lazy(1.5)
74+
.divide(1)
75+
.ceil(0)
76+
.default("m");
77+
expect(base.value()).toEqual(base1.value());
78+
});
79+
6580
it("default", () => {
6681
const base = LazyBase.lazy(1.5)
6782
.divide(0)
6883
.default(99);
6984
expect(base.value()).toBe(99);
7085
});
7186

87+
it("add with invalid", () => {
88+
const base = LazyBase.lazy(1.5)
89+
.divide(0)
90+
.add(6)
91+
.default(99);
92+
expect(base.value()).toBe(99);
93+
});
94+
95+
it("subtract with invalid", () => {
96+
const base = LazyBase.lazy(1.5)
97+
.divide(0)
98+
.subtract(6)
99+
.default(99);
100+
expect(base.value()).toBe(99);
101+
});
102+
103+
it("divide with invalid", () => {
104+
const base = LazyBase.lazy(1.5)
105+
.divide(0)
106+
.divide(6)
107+
.default(99);
108+
expect(base.value()).toBe(99);
109+
});
110+
111+
it("multiply with invalid", () => {
112+
const base = LazyBase.lazy(1.5)
113+
.divide(0)
114+
.multiply(6)
115+
.default(99);
116+
expect(base.value()).toBe(99);
117+
});
118+
72119
it("do", () => {
73120
const base = LazyBase.lazy({ num: 1.5 })
74121
.do((x: { num: number }) => x.num)

0 commit comments

Comments
 (0)