@wireio/shared 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/test-cjs/guards/array.test.js +12 -10
- package/lib/test-cjs/guards/array.test.js.map +1 -1
- package/lib/test-cjs/guards/assert.test.js +24 -22
- package/lib/test-cjs/guards/assert.test.js.map +1 -1
- package/lib/test-cjs/guards/class.test.js +17 -15
- package/lib/test-cjs/guards/class.test.js.map +1 -1
- package/lib/test-cjs/guards/guard-tools.test.js +18 -16
- package/lib/test-cjs/guards/guard-tools.test.js.map +1 -1
- package/lib/test-cjs/guards/primitive.test.js +72 -70
- package/lib/test-cjs/guards/primitive.test.js.map +1 -1
- package/lib/test-cjs/helpers/Deferred.test.js +38 -36
- package/lib/test-cjs/helpers/Deferred.test.js.map +1 -1
- package/lib/test-cjs/logging/ConsoleAppender.test.js +19 -17
- package/lib/test-cjs/logging/ConsoleAppender.test.js.map +1 -1
- package/lib/test-cjs/logging/Level.test.js +27 -25
- package/lib/test-cjs/logging/Level.test.js.map +1 -1
- package/lib/test-cjs/logging/Logger.test.js +14 -12
- package/lib/test-cjs/logging/Logger.test.js.map +1 -1
- package/lib/test-cjs/logging/LoggingManager.test.js +22 -20
- package/lib/test-cjs/logging/LoggingManager.test.js.map +1 -1
- package/lib/test-cjs/logging/util.test.js +21 -19
- package/lib/test-cjs/logging/util.test.js.map +1 -1
- package/lib/tsconfig.cjs.jest.tsbuildinfo +1 -1
- package/package.json +1 -2
|
@@ -1,236 +1,238 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const primitive_1 = require("@wireio/shared/guards/primitive");
|
|
2
4
|
describe("isNil", () => {
|
|
3
5
|
it("returns true for null", () => {
|
|
4
|
-
expect(isNil(null)).toBe(true);
|
|
6
|
+
expect((0, primitive_1.isNil)(null)).toBe(true);
|
|
5
7
|
});
|
|
6
8
|
it("returns true for undefined", () => {
|
|
7
|
-
expect(isNil(undefined)).toBe(true);
|
|
9
|
+
expect((0, primitive_1.isNil)(undefined)).toBe(true);
|
|
8
10
|
});
|
|
9
11
|
it("returns false for 0", () => {
|
|
10
|
-
expect(isNil(0)).toBe(false);
|
|
12
|
+
expect((0, primitive_1.isNil)(0)).toBe(false);
|
|
11
13
|
});
|
|
12
14
|
it("returns false for empty string", () => {
|
|
13
|
-
expect(isNil("")).toBe(false);
|
|
15
|
+
expect((0, primitive_1.isNil)("")).toBe(false);
|
|
14
16
|
});
|
|
15
17
|
it("returns false for false", () => {
|
|
16
|
-
expect(isNil(false)).toBe(false);
|
|
18
|
+
expect((0, primitive_1.isNil)(false)).toBe(false);
|
|
17
19
|
});
|
|
18
20
|
it("returns false for empty object", () => {
|
|
19
|
-
expect(isNil({})).toBe(false);
|
|
21
|
+
expect((0, primitive_1.isNil)({})).toBe(false);
|
|
20
22
|
});
|
|
21
23
|
it("returns false for empty array", () => {
|
|
22
|
-
expect(isNil([])).toBe(false);
|
|
24
|
+
expect((0, primitive_1.isNil)([])).toBe(false);
|
|
23
25
|
});
|
|
24
26
|
});
|
|
25
27
|
describe("isDefined", () => {
|
|
26
28
|
it("returns false for null", () => {
|
|
27
|
-
expect(isDefined(null)).toBe(false);
|
|
29
|
+
expect((0, primitive_1.isDefined)(null)).toBe(false);
|
|
28
30
|
});
|
|
29
31
|
it("returns false for undefined", () => {
|
|
30
|
-
expect(isDefined(undefined)).toBe(false);
|
|
32
|
+
expect((0, primitive_1.isDefined)(undefined)).toBe(false);
|
|
31
33
|
});
|
|
32
34
|
it("returns true for 0", () => {
|
|
33
|
-
expect(isDefined(0)).toBe(true);
|
|
35
|
+
expect((0, primitive_1.isDefined)(0)).toBe(true);
|
|
34
36
|
});
|
|
35
37
|
it("returns true for empty string", () => {
|
|
36
|
-
expect(isDefined("")).toBe(true);
|
|
38
|
+
expect((0, primitive_1.isDefined)("")).toBe(true);
|
|
37
39
|
});
|
|
38
40
|
it("returns true for false", () => {
|
|
39
|
-
expect(isDefined(false)).toBe(true);
|
|
41
|
+
expect((0, primitive_1.isDefined)(false)).toBe(true);
|
|
40
42
|
});
|
|
41
43
|
it("returns true for empty object", () => {
|
|
42
|
-
expect(isDefined({})).toBe(true);
|
|
44
|
+
expect((0, primitive_1.isDefined)({})).toBe(true);
|
|
43
45
|
});
|
|
44
46
|
it("returns true for empty array", () => {
|
|
45
|
-
expect(isDefined([])).toBe(true);
|
|
47
|
+
expect((0, primitive_1.isDefined)([])).toBe(true);
|
|
46
48
|
});
|
|
47
49
|
});
|
|
48
50
|
describe("isObject", () => {
|
|
49
51
|
it("returns true for plain object", () => {
|
|
50
|
-
expect(isObject({})).toBe(true);
|
|
52
|
+
expect((0, primitive_1.isObject)({})).toBe(true);
|
|
51
53
|
});
|
|
52
54
|
it("returns true for array", () => {
|
|
53
|
-
expect(isObject([])).toBe(true);
|
|
55
|
+
expect((0, primitive_1.isObject)([])).toBe(true);
|
|
54
56
|
});
|
|
55
57
|
it("returns true for Date", () => {
|
|
56
|
-
expect(isObject(new Date())).toBe(true);
|
|
58
|
+
expect((0, primitive_1.isObject)(new Date())).toBe(true);
|
|
57
59
|
});
|
|
58
60
|
it("returns false for null", () => {
|
|
59
|
-
expect(isObject(null)).toBe(false);
|
|
61
|
+
expect((0, primitive_1.isObject)(null)).toBe(false);
|
|
60
62
|
});
|
|
61
63
|
it("returns false for undefined", () => {
|
|
62
|
-
expect(isObject(undefined)).toBe(false);
|
|
64
|
+
expect((0, primitive_1.isObject)(undefined)).toBe(false);
|
|
63
65
|
});
|
|
64
66
|
it("returns false for string", () => {
|
|
65
|
-
expect(isObject("string")).toBe(false);
|
|
67
|
+
expect((0, primitive_1.isObject)("string")).toBe(false);
|
|
66
68
|
});
|
|
67
69
|
it("returns false for number", () => {
|
|
68
|
-
expect(isObject(123)).toBe(false);
|
|
70
|
+
expect((0, primitive_1.isObject)(123)).toBe(false);
|
|
69
71
|
});
|
|
70
72
|
});
|
|
71
73
|
describe("isPromise", () => {
|
|
72
74
|
it("returns true for Promise.resolve()", () => {
|
|
73
|
-
expect(isPromise(Promise.resolve())).toBe(true);
|
|
75
|
+
expect((0, primitive_1.isPromise)(Promise.resolve())).toBe(true);
|
|
74
76
|
});
|
|
75
77
|
it("returns true for new Promise", () => {
|
|
76
|
-
expect(isPromise(new Promise(() => { }))).toBe(true);
|
|
78
|
+
expect((0, primitive_1.isPromise)(new Promise(() => { }))).toBe(true);
|
|
77
79
|
});
|
|
78
80
|
it("returns true for thenable object", () => {
|
|
79
|
-
expect(isPromise({ then: () => { } })).toBe(true);
|
|
81
|
+
expect((0, primitive_1.isPromise)({ then: () => { } })).toBe(true);
|
|
80
82
|
});
|
|
81
83
|
it("returns false for plain object", () => {
|
|
82
|
-
expect(isPromise({})).toBe(false);
|
|
84
|
+
expect((0, primitive_1.isPromise)({})).toBe(false);
|
|
83
85
|
});
|
|
84
86
|
it("returns false for null", () => {
|
|
85
|
-
expect(isPromise(null)).toBe(false);
|
|
87
|
+
expect((0, primitive_1.isPromise)(null)).toBe(false);
|
|
86
88
|
});
|
|
87
89
|
});
|
|
88
90
|
describe("isObjectType", () => {
|
|
89
91
|
it("returns true for matching type", () => {
|
|
90
|
-
expect(isObjectType(new Date(), Date)).toBe(true);
|
|
92
|
+
expect((0, primitive_1.isObjectType)(new Date(), Date)).toBe(true);
|
|
91
93
|
});
|
|
92
94
|
it("returns false for non-matching type", () => {
|
|
93
|
-
expect(isObjectType("hello", Date)).toBe(false);
|
|
95
|
+
expect((0, primitive_1.isObjectType)("hello", Date)).toBe(false);
|
|
94
96
|
});
|
|
95
97
|
it("returns false for null", () => {
|
|
96
|
-
expect(isObjectType(null, Date)).toBe(false);
|
|
98
|
+
expect((0, primitive_1.isObjectType)(null, Date)).toBe(false);
|
|
97
99
|
});
|
|
98
100
|
});
|
|
99
101
|
describe("isString", () => {
|
|
100
102
|
it("returns true for hello", () => {
|
|
101
|
-
expect(isString("hello")).toBe(true);
|
|
103
|
+
expect((0, primitive_1.isString)("hello")).toBe(true);
|
|
102
104
|
});
|
|
103
105
|
it("returns true for empty string", () => {
|
|
104
|
-
expect(isString("")).toBe(true);
|
|
106
|
+
expect((0, primitive_1.isString)("")).toBe(true);
|
|
105
107
|
});
|
|
106
108
|
it("returns false for null", () => {
|
|
107
|
-
expect(isString(null)).toBe(false);
|
|
109
|
+
expect((0, primitive_1.isString)(null)).toBe(false);
|
|
108
110
|
});
|
|
109
111
|
it("returns false for number", () => {
|
|
110
|
-
expect(isString(123)).toBe(false);
|
|
112
|
+
expect((0, primitive_1.isString)(123)).toBe(false);
|
|
111
113
|
});
|
|
112
114
|
it("returns false for undefined", () => {
|
|
113
|
-
expect(isString(undefined)).toBe(false);
|
|
115
|
+
expect((0, primitive_1.isString)(undefined)).toBe(false);
|
|
114
116
|
});
|
|
115
117
|
});
|
|
116
118
|
describe("isNumber", () => {
|
|
117
119
|
it("returns true for 0", () => {
|
|
118
|
-
expect(isNumber(0)).toBe(true);
|
|
120
|
+
expect((0, primitive_1.isNumber)(0)).toBe(true);
|
|
119
121
|
});
|
|
120
122
|
it("returns true for 1", () => {
|
|
121
|
-
expect(isNumber(1)).toBe(true);
|
|
123
|
+
expect((0, primitive_1.isNumber)(1)).toBe(true);
|
|
122
124
|
});
|
|
123
125
|
it("returns true for -1", () => {
|
|
124
|
-
expect(isNumber(-1)).toBe(true);
|
|
126
|
+
expect((0, primitive_1.isNumber)(-1)).toBe(true);
|
|
125
127
|
});
|
|
126
128
|
it("returns true for 1.5", () => {
|
|
127
|
-
expect(isNumber(1.5)).toBe(true);
|
|
129
|
+
expect((0, primitive_1.isNumber)(1.5)).toBe(true);
|
|
128
130
|
});
|
|
129
131
|
it("returns false for NaN", () => {
|
|
130
|
-
expect(isNumber(NaN)).toBe(false);
|
|
132
|
+
expect((0, primitive_1.isNumber)(NaN)).toBe(false);
|
|
131
133
|
});
|
|
132
134
|
it("returns false for null", () => {
|
|
133
|
-
expect(isNumber(null)).toBe(false);
|
|
135
|
+
expect((0, primitive_1.isNumber)(null)).toBe(false);
|
|
134
136
|
});
|
|
135
137
|
it("returns false for string number", () => {
|
|
136
|
-
expect(isNumber("1")).toBe(false);
|
|
138
|
+
expect((0, primitive_1.isNumber)("1")).toBe(false);
|
|
137
139
|
});
|
|
138
140
|
it("returns false for undefined", () => {
|
|
139
|
-
expect(isNumber(undefined)).toBe(false);
|
|
141
|
+
expect((0, primitive_1.isNumber)(undefined)).toBe(false);
|
|
140
142
|
});
|
|
141
143
|
});
|
|
142
144
|
describe("isFunction", () => {
|
|
143
145
|
it("returns true for arrow function", () => {
|
|
144
|
-
expect(isFunction(() => { })).toBe(true);
|
|
146
|
+
expect((0, primitive_1.isFunction)(() => { })).toBe(true);
|
|
145
147
|
});
|
|
146
148
|
it("returns true for function expression", () => {
|
|
147
|
-
expect(isFunction(function () { })).toBe(true);
|
|
149
|
+
expect((0, primitive_1.isFunction)(function () { })).toBe(true);
|
|
148
150
|
});
|
|
149
151
|
it("returns true for class", () => {
|
|
150
|
-
expect(isFunction(class Foo {
|
|
152
|
+
expect((0, primitive_1.isFunction)(class Foo {
|
|
151
153
|
})).toBe(true);
|
|
152
154
|
});
|
|
153
155
|
it("returns false for null", () => {
|
|
154
|
-
expect(isFunction(null)).toBe(false);
|
|
156
|
+
expect((0, primitive_1.isFunction)(null)).toBe(false);
|
|
155
157
|
});
|
|
156
158
|
it("returns false for object", () => {
|
|
157
|
-
expect(isFunction({})).toBe(false);
|
|
159
|
+
expect((0, primitive_1.isFunction)({})).toBe(false);
|
|
158
160
|
});
|
|
159
161
|
});
|
|
160
162
|
describe("isSymbol", () => {
|
|
161
163
|
it("returns true for Symbol", () => {
|
|
162
|
-
expect(isSymbol(Symbol("test"))).toBe(true);
|
|
164
|
+
expect((0, primitive_1.isSymbol)(Symbol("test"))).toBe(true);
|
|
163
165
|
});
|
|
164
166
|
it("returns false for string", () => {
|
|
165
|
-
expect(isSymbol("symbol")).toBe(false);
|
|
167
|
+
expect((0, primitive_1.isSymbol)("symbol")).toBe(false);
|
|
166
168
|
});
|
|
167
169
|
it("returns false for null", () => {
|
|
168
|
-
expect(isSymbol(null)).toBe(false);
|
|
170
|
+
expect((0, primitive_1.isSymbol)(null)).toBe(false);
|
|
169
171
|
});
|
|
170
172
|
});
|
|
171
173
|
describe("isBoolean", () => {
|
|
172
174
|
it("returns true for true", () => {
|
|
173
|
-
expect(isBoolean(true)).toBe(true);
|
|
175
|
+
expect((0, primitive_1.isBoolean)(true)).toBe(true);
|
|
174
176
|
});
|
|
175
177
|
it("returns true for false", () => {
|
|
176
|
-
expect(isBoolean(false)).toBe(true);
|
|
178
|
+
expect((0, primitive_1.isBoolean)(false)).toBe(true);
|
|
177
179
|
});
|
|
178
180
|
it("returns false for 0", () => {
|
|
179
|
-
expect(isBoolean(0)).toBe(false);
|
|
181
|
+
expect((0, primitive_1.isBoolean)(0)).toBe(false);
|
|
180
182
|
});
|
|
181
183
|
it("returns false for 1", () => {
|
|
182
|
-
expect(isBoolean(1)).toBe(false);
|
|
184
|
+
expect((0, primitive_1.isBoolean)(1)).toBe(false);
|
|
183
185
|
});
|
|
184
186
|
it("returns false for null", () => {
|
|
185
|
-
expect(isBoolean(null)).toBe(false);
|
|
187
|
+
expect((0, primitive_1.isBoolean)(null)).toBe(false);
|
|
186
188
|
});
|
|
187
189
|
it("returns false for string true", () => {
|
|
188
|
-
expect(isBoolean("true")).toBe(false);
|
|
190
|
+
expect((0, primitive_1.isBoolean)("true")).toBe(false);
|
|
189
191
|
});
|
|
190
192
|
});
|
|
191
193
|
describe("isDate", () => {
|
|
192
194
|
it("returns true for new Date()", () => {
|
|
193
|
-
expect(isDate(new Date())).toBe(true);
|
|
195
|
+
expect((0, primitive_1.isDate)(new Date())).toBe(true);
|
|
194
196
|
});
|
|
195
197
|
it("returns false for Date.now()", () => {
|
|
196
|
-
expect(isDate(Date.now())).toBe(false);
|
|
198
|
+
expect((0, primitive_1.isDate)(Date.now())).toBe(false);
|
|
197
199
|
});
|
|
198
200
|
it("returns false for date string", () => {
|
|
199
|
-
expect(isDate("2024-01-01")).toBe(false);
|
|
201
|
+
expect((0, primitive_1.isDate)("2024-01-01")).toBe(false);
|
|
200
202
|
});
|
|
201
203
|
});
|
|
202
204
|
describe("isPrimitive", () => {
|
|
203
205
|
it("returns true for boolean", () => {
|
|
204
|
-
expect(isPrimitive(true)).toBe(true);
|
|
206
|
+
expect((0, primitive_1.isPrimitive)(true)).toBe(true);
|
|
205
207
|
});
|
|
206
208
|
it("returns true for string", () => {
|
|
207
|
-
expect(isPrimitive("hello")).toBe(true);
|
|
209
|
+
expect((0, primitive_1.isPrimitive)("hello")).toBe(true);
|
|
208
210
|
});
|
|
209
211
|
it("returns true for number", () => {
|
|
210
|
-
expect(isPrimitive(42)).toBe(true);
|
|
212
|
+
expect((0, primitive_1.isPrimitive)(42)).toBe(true);
|
|
211
213
|
});
|
|
212
214
|
it("returns false for object", () => {
|
|
213
|
-
expect(isPrimitive({})).toBe(false);
|
|
215
|
+
expect((0, primitive_1.isPrimitive)({})).toBe(false);
|
|
214
216
|
});
|
|
215
217
|
it("returns false for array", () => {
|
|
216
|
-
expect(isPrimitive([])).toBe(false);
|
|
218
|
+
expect((0, primitive_1.isPrimitive)([])).toBe(false);
|
|
217
219
|
});
|
|
218
220
|
it("returns false for null", () => {
|
|
219
|
-
expect(isPrimitive(null)).toBe(false);
|
|
221
|
+
expect((0, primitive_1.isPrimitive)(null)).toBe(false);
|
|
220
222
|
});
|
|
221
223
|
});
|
|
222
224
|
describe("isPrimitiveProducer", () => {
|
|
223
225
|
it("returns true for String constructor", () => {
|
|
224
|
-
expect(isPrimitiveProducer(String)).toBe(true);
|
|
226
|
+
expect((0, primitive_1.isPrimitiveProducer)(String)).toBe(true);
|
|
225
227
|
});
|
|
226
228
|
it("returns true for Number constructor", () => {
|
|
227
|
-
expect(isPrimitiveProducer(Number)).toBe(true);
|
|
229
|
+
expect((0, primitive_1.isPrimitiveProducer)(Number)).toBe(true);
|
|
228
230
|
});
|
|
229
231
|
it("returns true for Boolean constructor", () => {
|
|
230
|
-
expect(isPrimitiveProducer(Boolean)).toBe(true);
|
|
232
|
+
expect((0, primitive_1.isPrimitiveProducer)(Boolean)).toBe(true);
|
|
231
233
|
});
|
|
232
234
|
it("returns false for a regular function", () => {
|
|
233
|
-
expect(isPrimitiveProducer(() => "hello")).toBe(false);
|
|
235
|
+
expect((0, primitive_1.isPrimitiveProducer)(() => "hello")).toBe(false);
|
|
234
236
|
});
|
|
235
237
|
});
|
|
236
238
|
//# sourceMappingURL=primitive.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitive.test.js","sourceRoot":"","sources":["../../../tests/guards/primitive.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,WAAW,EACX,mBAAmB,EACpB,MAAM,iCAAiC,CAAA;AAExC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,KAA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AE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {\n isNil,\n isDefined,\n isObject,\n isPromise,\n isObjectType,\n isString,\n isNumber,\n isFunction,\n isSymbol,\n isBoolean,\n isDate,\n isPrimitive,\n isPrimitiveProducer\n} from \"@wireio/shared/guards/primitive\"\n\ndescribe(\"isNil\", () => {\n it(\"returns true for null\", () => {\n expect(isNil(null)).toBe(true)\n })\n\n it(\"returns true for undefined\", () => {\n expect(isNil(undefined)).toBe(true)\n })\n\n it(\"returns false for 0\", () => {\n expect(isNil(0)).toBe(false)\n })\n\n it(\"returns false for empty string\", () => {\n expect(isNil(\"\")).toBe(false)\n })\n\n it(\"returns false for false\", () => {\n expect(isNil(false)).toBe(false)\n })\n\n it(\"returns false for empty object\", () => {\n expect(isNil({})).toBe(false)\n })\n\n it(\"returns false for empty array\", () => {\n expect(isNil([])).toBe(false)\n })\n})\n\ndescribe(\"isDefined\", () => {\n it(\"returns false for null\", () => {\n expect(isDefined(null)).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isDefined(undefined)).toBe(false)\n })\n\n it(\"returns true for 0\", () => {\n expect(isDefined(0)).toBe(true)\n })\n\n it(\"returns true for empty string\", () => {\n expect(isDefined(\"\")).toBe(true)\n })\n\n it(\"returns true for false\", () => {\n expect(isDefined(false)).toBe(true)\n })\n\n it(\"returns true for empty object\", () => {\n expect(isDefined({})).toBe(true)\n })\n\n it(\"returns true for empty array\", () => {\n expect(isDefined([])).toBe(true)\n })\n})\n\ndescribe(\"isObject\", () => {\n it(\"returns true for plain object\", () => {\n expect(isObject({})).toBe(true)\n })\n\n it(\"returns true for array\", () => {\n expect(isObject([])).toBe(true)\n })\n\n it(\"returns true for Date\", () => {\n expect(isObject(new Date())).toBe(true)\n })\n\n it(\"returns false for null\", () => {\n expect(isObject(null)).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isObject(undefined)).toBe(false)\n })\n\n it(\"returns false for string\", () => {\n expect(isObject(\"string\")).toBe(false)\n })\n\n it(\"returns false for number\", () => {\n expect(isObject(123)).toBe(false)\n })\n})\n\ndescribe(\"isPromise\", () => {\n it(\"returns true for Promise.resolve()\", () => {\n expect(isPromise(Promise.resolve())).toBe(true)\n })\n\n it(\"returns true for new Promise\", () => {\n expect(isPromise(new Promise(() => {}))).toBe(true)\n })\n\n it(\"returns true for thenable object\", () => {\n expect(isPromise({ then: () => {} })).toBe(true)\n })\n\n it(\"returns false for plain object\", () => {\n expect(isPromise({})).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isPromise(null)).toBe(false)\n })\n})\n\ndescribe(\"isObjectType\", () => {\n it(\"returns true for matching type\", () => {\n expect(isObjectType(new Date(), Date)).toBe(true)\n })\n\n it(\"returns false for non-matching type\", () => {\n expect(isObjectType(\"hello\", Date)).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isObjectType(null, Date)).toBe(false)\n })\n})\n\ndescribe(\"isString\", () => {\n it(\"returns true for hello\", () => {\n expect(isString(\"hello\")).toBe(true)\n })\n\n it(\"returns true for empty string\", () => {\n expect(isString(\"\")).toBe(true)\n })\n\n it(\"returns false for null\", () => {\n expect(isString(null)).toBe(false)\n })\n\n it(\"returns false for number\", () => {\n expect(isString(123)).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isString(undefined)).toBe(false)\n })\n})\n\ndescribe(\"isNumber\", () => {\n it(\"returns true for 0\", () => {\n expect(isNumber(0)).toBe(true)\n })\n\n it(\"returns true for 1\", () => {\n expect(isNumber(1)).toBe(true)\n })\n\n it(\"returns true for -1\", () => {\n expect(isNumber(-1)).toBe(true)\n })\n\n it(\"returns true for 1.5\", () => {\n expect(isNumber(1.5)).toBe(true)\n })\n\n it(\"returns false for NaN\", () => {\n expect(isNumber(NaN)).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isNumber(null)).toBe(false)\n })\n\n it(\"returns false for string number\", () => {\n expect(isNumber(\"1\")).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isNumber(undefined)).toBe(false)\n })\n})\n\ndescribe(\"isFunction\", () => {\n it(\"returns true for arrow function\", () => {\n expect(isFunction(() => {})).toBe(true)\n })\n\n it(\"returns true for function expression\", () => {\n expect(\n isFunction(function () {})\n ).toBe(true)\n })\n\n it(\"returns true for class\", () => {\n expect(isFunction(class Foo {})).toBe(true)\n })\n\n it(\"returns false for null\", () => {\n expect(isFunction(null)).toBe(false)\n })\n\n it(\"returns false for object\", () => {\n expect(isFunction({})).toBe(false)\n })\n})\n\ndescribe(\"isSymbol\", () => {\n it(\"returns true for Symbol\", () => {\n expect(isSymbol(Symbol(\"test\"))).toBe(true)\n })\n\n it(\"returns false for string\", () => {\n expect(isSymbol(\"symbol\")).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isSymbol(null)).toBe(false)\n })\n})\n\ndescribe(\"isBoolean\", () => {\n it(\"returns true for true\", () => {\n expect(isBoolean(true)).toBe(true)\n })\n\n it(\"returns true for false\", () => {\n expect(isBoolean(false)).toBe(true)\n })\n\n it(\"returns false for 0\", () => {\n expect(isBoolean(0)).toBe(false)\n })\n\n it(\"returns false for 1\", () => {\n expect(isBoolean(1)).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isBoolean(null)).toBe(false)\n })\n\n it(\"returns false for string true\", () => {\n expect(isBoolean(\"true\")).toBe(false)\n })\n})\n\ndescribe(\"isDate\", () => {\n it(\"returns true for new Date()\", () => {\n expect(isDate(new Date())).toBe(true)\n })\n\n it(\"returns false for Date.now()\", () => {\n expect(isDate(Date.now())).toBe(false)\n })\n\n it(\"returns false for date string\", () => {\n expect(isDate(\"2024-01-01\")).toBe(false)\n })\n})\n\ndescribe(\"isPrimitive\", () => {\n it(\"returns true for boolean\", () => {\n expect(isPrimitive(true)).toBe(true)\n })\n\n it(\"returns true for string\", () => {\n expect(isPrimitive(\"hello\")).toBe(true)\n })\n\n it(\"returns true for number\", () => {\n expect(isPrimitive(42)).toBe(true)\n })\n\n it(\"returns false for object\", () => {\n expect(isPrimitive({})).toBe(false)\n })\n\n it(\"returns false for array\", () => {\n expect(isPrimitive([])).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isPrimitive(null)).toBe(false)\n })\n})\n\ndescribe(\"isPrimitiveProducer\", () => {\n it(\"returns true for String constructor\", () => {\n expect(isPrimitiveProducer(String)).toBe(true)\n })\n\n it(\"returns true for Number constructor\", () => {\n expect(isPrimitiveProducer(Number)).toBe(true)\n })\n\n it(\"returns true for Boolean constructor\", () => {\n expect(isPrimitiveProducer(Boolean)).toBe(true)\n })\n\n it(\"returns false for a regular function\", () => {\n expect(isPrimitiveProducer(() => \"hello\")).toBe(false)\n })\n})\n"]}
|
|
1
|
+
{"version":3,"file":"primitive.test.js","sourceRoot":"","sources":["../../../tests/guards/primitive.test.ts"],"names":[],"mappings":";;AAAA,+DAcwC;AAExC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,CAAC,IAAA,iBAAK,EAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,CAAC,IAAA,iBAAK,EAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,MAAM,CAAC,IAAA,iBAAK,EAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,CAAC,IAAA,iBAAK,EAAC,EAAE,C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,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,IAAA,+BAAmB,EAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,IAAA,+BAAmB,EAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,IAAA,+BAAmB,EAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import {\n isNil,\n isDefined,\n isObject,\n isPromise,\n isObjectType,\n isString,\n isNumber,\n isFunction,\n isSymbol,\n isBoolean,\n isDate,\n isPrimitive,\n isPrimitiveProducer\n} from \"@wireio/shared/guards/primitive\"\n\ndescribe(\"isNil\", () => {\n it(\"returns true for null\", () => {\n expect(isNil(null)).toBe(true)\n })\n\n it(\"returns true for undefined\", () => {\n expect(isNil(undefined)).toBe(true)\n })\n\n it(\"returns false for 0\", () => {\n expect(isNil(0)).toBe(false)\n })\n\n it(\"returns false for empty string\", () => {\n expect(isNil(\"\")).toBe(false)\n })\n\n it(\"returns false for false\", () => {\n expect(isNil(false)).toBe(false)\n })\n\n it(\"returns false for empty object\", () => {\n expect(isNil({})).toBe(false)\n })\n\n it(\"returns false for empty array\", () => {\n expect(isNil([])).toBe(false)\n })\n})\n\ndescribe(\"isDefined\", () => {\n it(\"returns false for null\", () => {\n expect(isDefined(null)).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isDefined(undefined)).toBe(false)\n })\n\n it(\"returns true for 0\", () => {\n expect(isDefined(0)).toBe(true)\n })\n\n it(\"returns true for empty string\", () => {\n expect(isDefined(\"\")).toBe(true)\n })\n\n it(\"returns true for false\", () => {\n expect(isDefined(false)).toBe(true)\n })\n\n it(\"returns true for empty object\", () => {\n expect(isDefined({})).toBe(true)\n })\n\n it(\"returns true for empty array\", () => {\n expect(isDefined([])).toBe(true)\n })\n})\n\ndescribe(\"isObject\", () => {\n it(\"returns true for plain object\", () => {\n expect(isObject({})).toBe(true)\n })\n\n it(\"returns true for array\", () => {\n expect(isObject([])).toBe(true)\n })\n\n it(\"returns true for Date\", () => {\n expect(isObject(new Date())).toBe(true)\n })\n\n it(\"returns false for null\", () => {\n expect(isObject(null)).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isObject(undefined)).toBe(false)\n })\n\n it(\"returns false for string\", () => {\n expect(isObject(\"string\")).toBe(false)\n })\n\n it(\"returns false for number\", () => {\n expect(isObject(123)).toBe(false)\n })\n})\n\ndescribe(\"isPromise\", () => {\n it(\"returns true for Promise.resolve()\", () => {\n expect(isPromise(Promise.resolve())).toBe(true)\n })\n\n it(\"returns true for new Promise\", () => {\n expect(isPromise(new Promise(() => {}))).toBe(true)\n })\n\n it(\"returns true for thenable object\", () => {\n expect(isPromise({ then: () => {} })).toBe(true)\n })\n\n it(\"returns false for plain object\", () => {\n expect(isPromise({})).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isPromise(null)).toBe(false)\n })\n})\n\ndescribe(\"isObjectType\", () => {\n it(\"returns true for matching type\", () => {\n expect(isObjectType(new Date(), Date)).toBe(true)\n })\n\n it(\"returns false for non-matching type\", () => {\n expect(isObjectType(\"hello\", Date)).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isObjectType(null, Date)).toBe(false)\n })\n})\n\ndescribe(\"isString\", () => {\n it(\"returns true for hello\", () => {\n expect(isString(\"hello\")).toBe(true)\n })\n\n it(\"returns true for empty string\", () => {\n expect(isString(\"\")).toBe(true)\n })\n\n it(\"returns false for null\", () => {\n expect(isString(null)).toBe(false)\n })\n\n it(\"returns false for number\", () => {\n expect(isString(123)).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isString(undefined)).toBe(false)\n })\n})\n\ndescribe(\"isNumber\", () => {\n it(\"returns true for 0\", () => {\n expect(isNumber(0)).toBe(true)\n })\n\n it(\"returns true for 1\", () => {\n expect(isNumber(1)).toBe(true)\n })\n\n it(\"returns true for -1\", () => {\n expect(isNumber(-1)).toBe(true)\n })\n\n it(\"returns true for 1.5\", () => {\n expect(isNumber(1.5)).toBe(true)\n })\n\n it(\"returns false for NaN\", () => {\n expect(isNumber(NaN)).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isNumber(null)).toBe(false)\n })\n\n it(\"returns false for string number\", () => {\n expect(isNumber(\"1\")).toBe(false)\n })\n\n it(\"returns false for undefined\", () => {\n expect(isNumber(undefined)).toBe(false)\n })\n})\n\ndescribe(\"isFunction\", () => {\n it(\"returns true for arrow function\", () => {\n expect(isFunction(() => {})).toBe(true)\n })\n\n it(\"returns true for function expression\", () => {\n expect(\n isFunction(function () {})\n ).toBe(true)\n })\n\n it(\"returns true for class\", () => {\n expect(isFunction(class Foo {})).toBe(true)\n })\n\n it(\"returns false for null\", () => {\n expect(isFunction(null)).toBe(false)\n })\n\n it(\"returns false for object\", () => {\n expect(isFunction({})).toBe(false)\n })\n})\n\ndescribe(\"isSymbol\", () => {\n it(\"returns true for Symbol\", () => {\n expect(isSymbol(Symbol(\"test\"))).toBe(true)\n })\n\n it(\"returns false for string\", () => {\n expect(isSymbol(\"symbol\")).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isSymbol(null)).toBe(false)\n })\n})\n\ndescribe(\"isBoolean\", () => {\n it(\"returns true for true\", () => {\n expect(isBoolean(true)).toBe(true)\n })\n\n it(\"returns true for false\", () => {\n expect(isBoolean(false)).toBe(true)\n })\n\n it(\"returns false for 0\", () => {\n expect(isBoolean(0)).toBe(false)\n })\n\n it(\"returns false for 1\", () => {\n expect(isBoolean(1)).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isBoolean(null)).toBe(false)\n })\n\n it(\"returns false for string true\", () => {\n expect(isBoolean(\"true\")).toBe(false)\n })\n})\n\ndescribe(\"isDate\", () => {\n it(\"returns true for new Date()\", () => {\n expect(isDate(new Date())).toBe(true)\n })\n\n it(\"returns false for Date.now()\", () => {\n expect(isDate(Date.now())).toBe(false)\n })\n\n it(\"returns false for date string\", () => {\n expect(isDate(\"2024-01-01\")).toBe(false)\n })\n})\n\ndescribe(\"isPrimitive\", () => {\n it(\"returns true for boolean\", () => {\n expect(isPrimitive(true)).toBe(true)\n })\n\n it(\"returns true for string\", () => {\n expect(isPrimitive(\"hello\")).toBe(true)\n })\n\n it(\"returns true for number\", () => {\n expect(isPrimitive(42)).toBe(true)\n })\n\n it(\"returns false for object\", () => {\n expect(isPrimitive({})).toBe(false)\n })\n\n it(\"returns false for array\", () => {\n expect(isPrimitive([])).toBe(false)\n })\n\n it(\"returns false for null\", () => {\n expect(isPrimitive(null)).toBe(false)\n })\n})\n\ndescribe(\"isPrimitiveProducer\", () => {\n it(\"returns true for String constructor\", () => {\n expect(isPrimitiveProducer(String)).toBe(true)\n })\n\n it(\"returns true for Number constructor\", () => {\n expect(isPrimitiveProducer(Number)).toBe(true)\n })\n\n it(\"returns true for Boolean constructor\", () => {\n expect(isPrimitiveProducer(Boolean)).toBe(true)\n })\n\n it(\"returns false for a regular function\", () => {\n expect(isPrimitiveProducer(() => \"hello\")).toBe(false)\n })\n})\n"]}
|
|
@@ -1,61 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Deferred_1 = require("@wireio/shared/helpers/Deferred");
|
|
2
4
|
describe("Deferred", () => {
|
|
3
5
|
describe("initial state", () => {
|
|
4
6
|
it("starts in PENDING status", () => {
|
|
5
|
-
const d = new Deferred();
|
|
6
|
-
expect(d.status()).toBe(DeferredStatus.PENDING);
|
|
7
|
+
const d = new Deferred_1.Deferred();
|
|
8
|
+
expect(d.status()).toBe(Deferred_1.DeferredStatus.PENDING);
|
|
7
9
|
});
|
|
8
10
|
it("isFulfilled() is false initially", () => {
|
|
9
|
-
const d = new Deferred();
|
|
11
|
+
const d = new Deferred_1.Deferred();
|
|
10
12
|
expect(d.isFulfilled()).toBe(false);
|
|
11
13
|
});
|
|
12
14
|
it("isRejected() is false initially", () => {
|
|
13
|
-
const d = new Deferred();
|
|
15
|
+
const d = new Deferred_1.Deferred();
|
|
14
16
|
expect(d.isRejected()).toBe(false);
|
|
15
17
|
});
|
|
16
18
|
it("isSettled() is false initially", () => {
|
|
17
|
-
const d = new Deferred();
|
|
19
|
+
const d = new Deferred_1.Deferred();
|
|
18
20
|
expect(d.isSettled()).toBe(false);
|
|
19
21
|
});
|
|
20
22
|
it("isCancelled() is false initially", () => {
|
|
21
|
-
const d = new Deferred();
|
|
23
|
+
const d = new Deferred_1.Deferred();
|
|
22
24
|
expect(d.isCancelled()).toBe(false);
|
|
23
25
|
});
|
|
24
26
|
});
|
|
25
27
|
describe("resolve", () => {
|
|
26
28
|
it("changes status to FULFILLED", () => {
|
|
27
|
-
const d = new Deferred();
|
|
29
|
+
const d = new Deferred_1.Deferred();
|
|
28
30
|
d.resolve(42);
|
|
29
|
-
expect(d.status()).toBe(DeferredStatus.FULFILLED);
|
|
31
|
+
expect(d.status()).toBe(Deferred_1.DeferredStatus.FULFILLED);
|
|
30
32
|
});
|
|
31
33
|
it("sets isFulfilled() to true", () => {
|
|
32
|
-
const d = new Deferred();
|
|
34
|
+
const d = new Deferred_1.Deferred();
|
|
33
35
|
d.resolve(42);
|
|
34
36
|
expect(d.isFulfilled()).toBe(true);
|
|
35
37
|
});
|
|
36
38
|
it("sets isSettled() to true", () => {
|
|
37
|
-
const d = new Deferred();
|
|
39
|
+
const d = new Deferred_1.Deferred();
|
|
38
40
|
d.resolve(42);
|
|
39
41
|
expect(d.isSettled()).toBe(true);
|
|
40
42
|
});
|
|
41
43
|
it("getResult() returns the resolved value", () => {
|
|
42
|
-
const d = new Deferred();
|
|
44
|
+
const d = new Deferred_1.Deferred();
|
|
43
45
|
d.resolve(42);
|
|
44
46
|
expect(d.getResult()).toBe(42);
|
|
45
47
|
});
|
|
46
48
|
it("promise resolves to the value", async () => {
|
|
47
|
-
const d = new Deferred();
|
|
49
|
+
const d = new Deferred_1.Deferred();
|
|
48
50
|
d.resolve(42);
|
|
49
51
|
await expect(d.promise).resolves.toBe(42);
|
|
50
52
|
});
|
|
51
53
|
it("subsequent resolve() is a no-op", () => {
|
|
52
|
-
const d = new Deferred();
|
|
54
|
+
const d = new Deferred_1.Deferred();
|
|
53
55
|
d.resolve(42);
|
|
54
56
|
d.resolve(99);
|
|
55
57
|
expect(d.getResult()).toBe(42);
|
|
56
58
|
});
|
|
57
59
|
it("subsequent reject() is a no-op after resolve", () => {
|
|
58
|
-
const d = new Deferred();
|
|
60
|
+
const d = new Deferred_1.Deferred();
|
|
59
61
|
d.resolve(42);
|
|
60
62
|
d.reject(new Error("fail"));
|
|
61
63
|
expect(d.isFulfilled()).toBe(true);
|
|
@@ -64,34 +66,34 @@ describe("Deferred", () => {
|
|
|
64
66
|
});
|
|
65
67
|
describe("reject", () => {
|
|
66
68
|
it("changes status to REJECTED", () => {
|
|
67
|
-
const d = new Deferred();
|
|
69
|
+
const d = new Deferred_1.Deferred();
|
|
68
70
|
const err = new Error("oops");
|
|
69
71
|
d.reject(err);
|
|
70
72
|
// Catch the promise to avoid unhandled rejection
|
|
71
73
|
d.promise.catch(() => { });
|
|
72
|
-
expect(d.status()).toBe(DeferredStatus.REJECTED);
|
|
74
|
+
expect(d.status()).toBe(Deferred_1.DeferredStatus.REJECTED);
|
|
73
75
|
});
|
|
74
76
|
it("sets isRejected() to true", () => {
|
|
75
|
-
const d = new Deferred();
|
|
77
|
+
const d = new Deferred_1.Deferred();
|
|
76
78
|
d.reject(new Error("oops"));
|
|
77
79
|
d.promise.catch(() => { });
|
|
78
80
|
expect(d.isRejected()).toBe(true);
|
|
79
81
|
});
|
|
80
82
|
it("sets isSettled() to true", () => {
|
|
81
|
-
const d = new Deferred();
|
|
83
|
+
const d = new Deferred_1.Deferred();
|
|
82
84
|
d.reject(new Error("oops"));
|
|
83
85
|
d.promise.catch(() => { });
|
|
84
86
|
expect(d.isSettled()).toBe(true);
|
|
85
87
|
});
|
|
86
88
|
it("getError() returns the error", () => {
|
|
87
|
-
const d = new Deferred();
|
|
89
|
+
const d = new Deferred_1.Deferred();
|
|
88
90
|
const err = new Error("oops");
|
|
89
91
|
d.reject(err);
|
|
90
92
|
d.promise.catch(() => { });
|
|
91
93
|
expect(d.getError()).toBe(err);
|
|
92
94
|
});
|
|
93
95
|
it("promise rejects with the error", async () => {
|
|
94
|
-
const d = new Deferred();
|
|
96
|
+
const d = new Deferred_1.Deferred();
|
|
95
97
|
const err = new Error("oops");
|
|
96
98
|
d.reject(err);
|
|
97
99
|
await expect(d.promise).rejects.toBe(err);
|
|
@@ -99,28 +101,28 @@ describe("Deferred", () => {
|
|
|
99
101
|
});
|
|
100
102
|
describe("cancel", () => {
|
|
101
103
|
it("sets isCancelled() to true", () => {
|
|
102
|
-
const d = new Deferred();
|
|
104
|
+
const d = new Deferred_1.Deferred();
|
|
103
105
|
d.cancel();
|
|
104
106
|
expect(d.isCancelled()).toBe(true);
|
|
105
107
|
});
|
|
106
108
|
it("sets isSettled() to true", () => {
|
|
107
|
-
const d = new Deferred();
|
|
109
|
+
const d = new Deferred_1.Deferred();
|
|
108
110
|
d.cancel();
|
|
109
111
|
expect(d.isSettled()).toBe(true);
|
|
110
112
|
});
|
|
111
113
|
it("sets status to CANCELED", () => {
|
|
112
|
-
const d = new Deferred();
|
|
114
|
+
const d = new Deferred_1.Deferred();
|
|
113
115
|
d.cancel();
|
|
114
|
-
expect(d.status()).toBe(DeferredStatus.CANCELED);
|
|
116
|
+
expect(d.status()).toBe(Deferred_1.DeferredStatus.CANCELED);
|
|
115
117
|
});
|
|
116
118
|
it("resolve() is a no-op after cancel", () => {
|
|
117
|
-
const d = new Deferred();
|
|
119
|
+
const d = new Deferred_1.Deferred();
|
|
118
120
|
d.cancel();
|
|
119
121
|
d.resolve(42);
|
|
120
122
|
expect(d.isFulfilled()).toBe(false);
|
|
121
123
|
});
|
|
122
124
|
it("reject() is a no-op after cancel", () => {
|
|
123
|
-
const d = new Deferred();
|
|
125
|
+
const d = new Deferred_1.Deferred();
|
|
124
126
|
d.cancel();
|
|
125
127
|
d.reject(new Error("fail"));
|
|
126
128
|
expect(d.isRejected()).toBe(false);
|
|
@@ -128,22 +130,22 @@ describe("Deferred", () => {
|
|
|
128
130
|
});
|
|
129
131
|
describe("getResult() and getError() when not settled", () => {
|
|
130
132
|
it("getResult() throws when not settled", () => {
|
|
131
|
-
const d = new Deferred();
|
|
133
|
+
const d = new Deferred_1.Deferred();
|
|
132
134
|
expect(() => d.getResult()).toThrow("Deferred promise is not settled, result is not available");
|
|
133
135
|
});
|
|
134
136
|
it("getError() throws when not settled", () => {
|
|
135
|
-
const d = new Deferred();
|
|
137
|
+
const d = new Deferred_1.Deferred();
|
|
136
138
|
expect(() => d.getError()).toThrow("Deferred promise is not settled, result is not available");
|
|
137
139
|
});
|
|
138
140
|
});
|
|
139
141
|
describe("value and error getters", () => {
|
|
140
142
|
it("value getter works same as getResult()", () => {
|
|
141
|
-
const d = new Deferred();
|
|
143
|
+
const d = new Deferred_1.Deferred();
|
|
142
144
|
d.resolve(42);
|
|
143
145
|
expect(d.value).toBe(d.getResult());
|
|
144
146
|
});
|
|
145
147
|
it("error getter works same as getError()", () => {
|
|
146
|
-
const d = new Deferred();
|
|
148
|
+
const d = new Deferred_1.Deferred();
|
|
147
149
|
d.reject(new Error("oops"));
|
|
148
150
|
d.promise.catch(() => { });
|
|
149
151
|
expect(d.error).toBe(d.getError());
|
|
@@ -151,7 +153,7 @@ describe("Deferred", () => {
|
|
|
151
153
|
});
|
|
152
154
|
describe("static resolve", () => {
|
|
153
155
|
it("creates a pre-resolved deferred", () => {
|
|
154
|
-
const d = Deferred.resolve(42);
|
|
156
|
+
const d = Deferred_1.Deferred.resolve(42);
|
|
155
157
|
expect(d.isFulfilled()).toBe(true);
|
|
156
158
|
expect(d.getResult()).toBe(42);
|
|
157
159
|
});
|
|
@@ -165,7 +167,7 @@ describe("Deferred", () => {
|
|
|
165
167
|
});
|
|
166
168
|
it("resolves after the specified timeout", async () => {
|
|
167
169
|
let resolved = false;
|
|
168
|
-
const p = Deferred.delay(1000).then(() => {
|
|
170
|
+
const p = Deferred_1.Deferred.delay(1000).then(() => {
|
|
169
171
|
resolved = true;
|
|
170
172
|
});
|
|
171
173
|
expect(resolved).toBe(false);
|
|
@@ -177,17 +179,17 @@ describe("Deferred", () => {
|
|
|
177
179
|
describe("constructor with existing promise", () => {
|
|
178
180
|
it("resolves when the provided promise resolves", async () => {
|
|
179
181
|
const p = Promise.resolve(42);
|
|
180
|
-
const d = new Deferred(p);
|
|
182
|
+
const d = new Deferred_1.Deferred(p);
|
|
181
183
|
await expect(d.promise).resolves.toBe(42);
|
|
182
184
|
});
|
|
183
185
|
it("rejects when the provided promise rejects", async () => {
|
|
184
186
|
const err = new Error("fail");
|
|
185
187
|
const p = Promise.reject(err);
|
|
186
|
-
const d = new Deferred(p);
|
|
188
|
+
const d = new Deferred_1.Deferred(p);
|
|
187
189
|
await expect(d.promise).rejects.toBe(err);
|
|
188
190
|
});
|
|
189
191
|
it("throws when given an invalid argument", () => {
|
|
190
|
-
expect(() => new Deferred("not a promise")).toThrow("An existing promise was provided to Deferred constructor, but it wasn't a valid promise");
|
|
192
|
+
expect(() => new Deferred_1.Deferred("not a promise")).toThrow("An existing promise was provided to Deferred constructor, but it wasn't a valid promise");
|
|
191
193
|
});
|
|
192
194
|
});
|
|
193
195
|
});
|