zation-assured 0.6.2 → 3.0.0-dev.3
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/LICENSE +1 -1
- package/README.md +55 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -9
- package/dist/lib/api/assert.d.ts +21 -14
- package/dist/lib/api/assert.js +17 -13
- package/dist/lib/api/testHelper.d.ts +0 -8
- package/dist/lib/api/testHelper.js +6 -83
- package/dist/lib/api/when.d.ts +41 -45
- package/dist/lib/api/when.js +42 -55
- package/dist/lib/helper/asserter/abstractActionAsserter.d.ts +68 -0
- package/dist/lib/helper/asserter/{rootSendAsserter.js → abstractActionAsserter.js} +23 -67
- package/dist/lib/helper/asserter/assertStarter.d.ts +5 -0
- package/dist/lib/helper/asserter/assertStarter.js +16 -0
- package/dist/lib/helper/asserter/channel/abstractChannelAsserter.d.ts +20 -29
- package/dist/lib/helper/asserter/channel/abstractChannelAsserter.js +44 -85
- package/dist/lib/helper/asserter/channel/channelAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/channel/channelAsserter.js +2 -2
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.d.ts +6 -6
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.js +7 -7
- package/dist/lib/helper/asserter/client/abstractClientAsserter.d.ts +20 -38
- package/dist/lib/helper/asserter/client/abstractClientAsserter.js +82 -184
- package/dist/lib/helper/asserter/client/clientAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/client/clientAsserter.js +2 -2
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.d.ts +6 -6
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.js +7 -7
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.d.ts +52 -0
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.js +122 -0
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.d.ts +54 -0
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.js +118 -0
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.d.ts +29 -36
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.js +44 -80
- package/dist/lib/helper/asserter/databox/databoxAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/databox/databoxAsserter.js +2 -2
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.d.ts +7 -6
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.js +7 -7
- package/dist/lib/helper/asserter/event/abstractEventAsserter.d.ts +12 -4
- package/dist/lib/helper/asserter/event/abstractEventAsserter.js +25 -10
- package/dist/lib/helper/asserter/event/codeMetadataEventAsserter.d.ts +21 -0
- package/dist/lib/helper/asserter/event/codeMetadataEventAsserter.js +47 -0
- package/dist/lib/helper/asserter/event/dataEventAsserter.d.ts +13 -3
- package/dist/lib/helper/asserter/event/dataEventAsserter.js +22 -4
- package/dist/lib/helper/asserter/receiver/integratedTransmitAsserter.d.ts +9 -0
- package/dist/lib/helper/asserter/receiver/{transmitAsserter.js → integratedTransmitAsserter.js} +9 -9
- package/dist/lib/helper/asserter/value/abstractValueAsserter.d.ts +13 -15
- package/dist/lib/helper/asserter/value/abstractValueAsserter.js +49 -53
- package/dist/lib/helper/asserter/value/standaloneValueAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/value/standaloneValueAsserter.js +6 -6
- package/dist/lib/helper/asserter/value/valueAsserter.d.ts +4 -4
- package/dist/lib/helper/asserter/value/valueAsserter.js +4 -4
- package/dist/lib/helper/backError/backErrorsFilterBuilder.d.ts +12 -0
- package/dist/lib/helper/backError/backErrorsFilterBuilder.js +29 -0
- package/dist/lib/helper/console/logger.js +2 -2
- package/dist/lib/helper/definitions/optionTypes.d.ts +8 -0
- package/dist/lib/helper/definitions/optionTypes.js +7 -0
- package/dist/lib/helper/test/test.d.ts +2 -2
- package/dist/lib/helper/test/test.js +8 -6
- package/dist/lib/helper/timeout/timeoutAssert.js +2 -2
- package/dist/lib/helper/utils/actionUtils.d.ts +5 -18
- package/dist/lib/helper/utils/actionUtils.js +14 -43
- package/dist/lib/helper/utils/types.d.ts +20 -0
- package/dist/lib/helper/utils/types.js +7 -0
- package/package.json +9 -12
- package/dist/lib/api/before.d.ts +0 -3
- package/dist/lib/api/before.js +0 -20
- package/dist/lib/api/client.d.ts +0 -3
- package/dist/lib/api/client.js +0 -11
- package/dist/lib/api/describe.d.ts +0 -1
- package/dist/lib/api/describe.js +0 -6
- package/dist/lib/api/instanceManager.d.ts +0 -8
- package/dist/lib/api/instanceManager.js +0 -48
- package/dist/lib/api/testArea.d.ts +0 -3
- package/dist/lib/api/testArea.js +0 -41
- package/dist/lib/api/testServerManager.d.ts +0 -19
- package/dist/lib/api/testServerManager.js +0 -100
- package/dist/lib/helper/asserter/abstractClientAsserter.d.ts +0 -102
- package/dist/lib/helper/asserter/abstractClientAsserter.js +0 -293
- package/dist/lib/helper/asserter/anyAsserter.d.ts +0 -62
- package/dist/lib/helper/asserter/anyAsserter.js +0 -130
- package/dist/lib/helper/asserter/channelEventAsserter.d.ts +0 -34
- package/dist/lib/helper/asserter/channelEventAsserter.js +0 -84
- package/dist/lib/helper/asserter/channelPubAsserter.d.ts +0 -53
- package/dist/lib/helper/asserter/channelPubAsserter.js +0 -126
- package/dist/lib/helper/asserter/clientAsserter.d.ts +0 -13
- package/dist/lib/helper/asserter/clientAsserter.js +0 -26
- package/dist/lib/helper/asserter/controller/responseAsserter.d.ts +0 -74
- package/dist/lib/helper/asserter/controller/responseAsserter.js +0 -138
- package/dist/lib/helper/asserter/dataEventAsserter.d.ts +0 -40
- package/dist/lib/helper/asserter/dataEventAsserter.js +0 -113
- package/dist/lib/helper/asserter/event/abstractDataEventAsserter.d.ts +0 -13
- package/dist/lib/helper/asserter/event/abstractDataEventAsserter.js +0 -36
- package/dist/lib/helper/asserter/event/codeDataEventAsserter.d.ts +0 -14
- package/dist/lib/helper/asserter/event/codeDataEventAsserter.js +0 -40
- package/dist/lib/helper/asserter/eventAsserter.d.ts +0 -41
- package/dist/lib/helper/asserter/eventAsserter.js +0 -115
- package/dist/lib/helper/asserter/objectAsserter.d.ts +0 -55
- package/dist/lib/helper/asserter/objectAsserter.js +0 -113
- package/dist/lib/helper/asserter/receiver/transmitAsserter.d.ts +0 -9
- package/dist/lib/helper/asserter/responseAsserter.d.ts +0 -129
- package/dist/lib/helper/asserter/responseAsserter.js +0 -260
- package/dist/lib/helper/asserter/rootSendAsserter.d.ts +0 -89
- package/dist/lib/helper/asserter/standaloneClientAsserter.d.ts +0 -11
- package/dist/lib/helper/asserter/standaloneClientAsserter.js +0 -38
- package/dist/lib/helper/assured/clientAssured.d.ts +0 -2
- package/dist/lib/helper/assured/clientAssured.js +0 -11
- package/dist/lib/helper/assured/responseAssured.d.ts +0 -17
- package/dist/lib/helper/assured/responseAssured.js +0 -72
- package/dist/lib/helper/backError/backErrorFilterBuilder.d.ts +0 -13
- package/dist/lib/helper/backError/backErrorFilterBuilder.js +0 -32
- package/dist/lib/helper/builder/controller/abstractRequestBuilder.d.ts +0 -53
- package/dist/lib/helper/builder/controller/abstractRequestBuilder.js +0 -69
- package/dist/lib/helper/builder/controller/authRequestBuilder.d.ts +0 -15
- package/dist/lib/helper/builder/controller/authRequestBuilder.js +0 -30
- package/dist/lib/helper/builder/controller/standardRequestBuilder.d.ts +0 -15
- package/dist/lib/helper/builder/controller/standardRequestBuilder.js +0 -30
- package/dist/lib/helper/builder/controller/validationCheckRequestBuilder.d.ts +0 -21
- package/dist/lib/helper/builder/controller/validationCheckRequestBuilder.js +0 -40
- package/dist/lib/helper/builder/receiver/packageBuilder.d.ts +0 -45
- package/dist/lib/helper/builder/receiver/packageBuilder.js +0 -67
- package/dist/lib/helper/controller/request/abstractRequestBuilder.d.ts +0 -53
- package/dist/lib/helper/controller/request/abstractRequestBuilder.js +0 -68
- package/dist/lib/helper/controller/request/authRequestBuilder.d.ts +0 -15
- package/dist/lib/helper/controller/request/authRequestBuilder.js +0 -29
- package/dist/lib/helper/controller/request/standardRequestBuilder.d.ts +0 -15
- package/dist/lib/helper/controller/request/standardRequestBuilder.js +0 -29
- package/dist/lib/helper/controller/request/validationCheckRequestBuilder.d.ts +0 -21
- package/dist/lib/helper/controller/request/validationCheckRequestBuilder.js +0 -39
- package/dist/lib/helper/data/test.d.ts +0 -13
- package/dist/lib/helper/data/test.js +0 -89
- package/dist/lib/helper/do/actionUtils.d.ts +0 -24
- package/dist/lib/helper/do/actionUtils.js +0 -70
- package/dist/lib/helper/do/doUtils.d.ts +0 -24
- package/dist/lib/helper/do/doUtils.js +0 -80
- package/dist/lib/helper/error/backErrorFilterBuilder.d.ts +0 -13
- package/dist/lib/helper/error/backErrorFilterBuilder.js +0 -34
- package/dist/lib/helper/error/taskErrorFilterBuilder.d.ts +0 -13
- package/dist/lib/helper/error/taskErrorFilterBuilder.js +0 -34
- package/dist/lib/helper/request/abstractRequestBuilder.d.ts +0 -53
- package/dist/lib/helper/request/abstractRequestBuilder.js +0 -68
- package/dist/lib/helper/request/authRequestBuilder.d.ts +0 -15
- package/dist/lib/helper/request/authRequestBuilder.js +0 -29
- package/dist/lib/helper/request/requestBuilder.d.ts +0 -46
- package/dist/lib/helper/request/requestBuilder.js +0 -76
- package/dist/lib/helper/request/standardRequestBuilder.d.ts +0 -15
- package/dist/lib/helper/request/standardRequestBuilder.js +0 -29
- package/dist/lib/helper/request/validationCheckRequestBuilder.d.ts +0 -21
- package/dist/lib/helper/request/validationCheckRequestBuilder.js +0 -39
- package/dist/lib/helper/request/validationRequestBuilder.d.ts +0 -35
- package/dist/lib/helper/request/validationRequestBuilder.js +0 -61
- package/dist/lib/helper/utils/clientUtils.d.ts +0 -4
- package/dist/lib/helper/utils/clientUtils.js +0 -29
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
8
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -15,12 +15,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.AbstractValueAsserter = void 0;
|
|
18
|
-
const
|
|
18
|
+
const queric_1 = require("queric");
|
|
19
19
|
const chai_1 = require("chai");
|
|
20
20
|
class AbstractValueAsserter {
|
|
21
|
-
constructor(
|
|
21
|
+
constructor(addTest) {
|
|
22
22
|
this.addTest = addTest;
|
|
23
|
-
this.name = name;
|
|
24
23
|
}
|
|
25
24
|
// noinspection JSUnusedGlobalSymbols
|
|
26
25
|
/**
|
|
@@ -28,8 +27,8 @@ class AbstractValueAsserter {
|
|
|
28
27
|
* Asserts that the value is undefined.
|
|
29
28
|
*/
|
|
30
29
|
isUndefined() {
|
|
31
|
-
this.addTest((value,
|
|
32
|
-
chai_1.assert(value === undefined, `${
|
|
30
|
+
this.addTest((value, target) => {
|
|
31
|
+
(0, chai_1.assert)(value === undefined, `${target} should be undefined.`);
|
|
33
32
|
});
|
|
34
33
|
return this.self();
|
|
35
34
|
}
|
|
@@ -39,8 +38,8 @@ class AbstractValueAsserter {
|
|
|
39
38
|
* Asserts that the value is not undefined.
|
|
40
39
|
*/
|
|
41
40
|
isNotUndefined() {
|
|
42
|
-
this.addTest((value,
|
|
43
|
-
chai_1.assert(value !== undefined, `${
|
|
41
|
+
this.addTest((value, target) => {
|
|
42
|
+
(0, chai_1.assert)(value !== undefined, `${target} should be not undefined.`);
|
|
44
43
|
});
|
|
45
44
|
return this.self();
|
|
46
45
|
}
|
|
@@ -51,8 +50,8 @@ class AbstractValueAsserter {
|
|
|
51
50
|
* @param type
|
|
52
51
|
*/
|
|
53
52
|
typeOf(type) {
|
|
54
|
-
this.addTest((value,
|
|
55
|
-
chai_1.assert.typeOf(value, type, `${
|
|
53
|
+
this.addTest((value, target) => {
|
|
54
|
+
chai_1.assert.typeOf(value, type, `${target} should be type of ${type}`);
|
|
56
55
|
});
|
|
57
56
|
return this.self();
|
|
58
57
|
}
|
|
@@ -63,8 +62,8 @@ class AbstractValueAsserter {
|
|
|
63
62
|
* @param type
|
|
64
63
|
*/
|
|
65
64
|
notTypeOf(type) {
|
|
66
|
-
this.addTest((value,
|
|
67
|
-
chai_1.assert.notTypeOf(value, type, `${
|
|
65
|
+
this.addTest((value, target) => {
|
|
66
|
+
chai_1.assert.notTypeOf(value, type, `${target} should be not type of ${type}`);
|
|
68
67
|
});
|
|
69
68
|
return this.self();
|
|
70
69
|
}
|
|
@@ -75,8 +74,8 @@ class AbstractValueAsserter {
|
|
|
75
74
|
* @param expectedValue
|
|
76
75
|
*/
|
|
77
76
|
contentEqual(expectedValue) {
|
|
78
|
-
this.addTest((value,
|
|
79
|
-
chai_1.assert.equal(value, expectedValue, `${
|
|
77
|
+
this.addTest((value, target) => {
|
|
78
|
+
chai_1.assert.equal(value, expectedValue, `${target} should be content equal with ${expectedValue}`);
|
|
80
79
|
});
|
|
81
80
|
return this.self();
|
|
82
81
|
}
|
|
@@ -87,8 +86,8 @@ class AbstractValueAsserter {
|
|
|
87
86
|
* @param expectedValue
|
|
88
87
|
*/
|
|
89
88
|
notContentEqual(expectedValue) {
|
|
90
|
-
this.addTest((value,
|
|
91
|
-
chai_1.assert.notEqual(value, expectedValue, `${
|
|
89
|
+
this.addTest((value, target) => {
|
|
90
|
+
chai_1.assert.notEqual(value, expectedValue, `${target} should be not content equal with ${expectedValue}`);
|
|
92
91
|
});
|
|
93
92
|
return this.self();
|
|
94
93
|
}
|
|
@@ -99,8 +98,8 @@ class AbstractValueAsserter {
|
|
|
99
98
|
* @param expectedValue
|
|
100
99
|
*/
|
|
101
100
|
equal(expectedValue) {
|
|
102
|
-
this.addTest((value,
|
|
103
|
-
chai_1.assert.strictEqual(value, expectedValue, `${
|
|
101
|
+
this.addTest((value, target) => {
|
|
102
|
+
chai_1.assert.strictEqual(value, expectedValue, `${target} should be strict equal with ${expectedValue}`);
|
|
104
103
|
});
|
|
105
104
|
return this.self();
|
|
106
105
|
}
|
|
@@ -111,8 +110,8 @@ class AbstractValueAsserter {
|
|
|
111
110
|
* @param expectedValue
|
|
112
111
|
*/
|
|
113
112
|
notEqual(expectedValue) {
|
|
114
|
-
this.addTest((value,
|
|
115
|
-
chai_1.assert.notStrictEqual(value, expectedValue, `${
|
|
113
|
+
this.addTest((value, target) => {
|
|
114
|
+
chai_1.assert.notStrictEqual(value, expectedValue, `${target} should be not strict equal with ${expectedValue}`);
|
|
116
115
|
});
|
|
117
116
|
return this.self();
|
|
118
117
|
}
|
|
@@ -123,8 +122,8 @@ class AbstractValueAsserter {
|
|
|
123
122
|
* @param expectedValue
|
|
124
123
|
*/
|
|
125
124
|
deepEqual(expectedValue) {
|
|
126
|
-
this.addTest((value,
|
|
127
|
-
chai_1.assert.deepEqual(value, expectedValue, `${
|
|
125
|
+
this.addTest((value, target) => {
|
|
126
|
+
chai_1.assert.deepEqual(value, expectedValue, `${target} should be deep strict equal with ${JSON.stringify(expectedValue)}`);
|
|
128
127
|
});
|
|
129
128
|
return this.self();
|
|
130
129
|
}
|
|
@@ -135,28 +134,28 @@ class AbstractValueAsserter {
|
|
|
135
134
|
* @param expectedValue
|
|
136
135
|
*/
|
|
137
136
|
notDeepEqual(expectedValue) {
|
|
138
|
-
this.addTest((value,
|
|
139
|
-
chai_1.assert.notDeepEqual(value, expectedValue, `${
|
|
137
|
+
this.addTest((value, target) => {
|
|
138
|
+
chai_1.assert.notDeepEqual(value, expectedValue, `${target} should be not deep strict equal with ${JSON.stringify(expectedValue)}`);
|
|
140
139
|
});
|
|
141
140
|
return this.self();
|
|
142
141
|
}
|
|
143
142
|
// noinspection JSUnusedGlobalSymbols
|
|
144
143
|
/**
|
|
145
|
-
* Asserts that the value matches with a
|
|
144
|
+
* Asserts that the value matches with a queric query.
|
|
146
145
|
*/
|
|
147
146
|
matches(query) {
|
|
148
|
-
this.addTest((inAny,
|
|
149
|
-
yield chai_1.assert(
|
|
147
|
+
this.addTest((inAny, target) => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
+
yield (0, chai_1.assert)((0, queric_1.default)(query)(inAny), `${target} should match with the queric query.`);
|
|
150
149
|
}));
|
|
151
150
|
return this.self();
|
|
152
151
|
}
|
|
153
152
|
// noinspection JSUnusedGlobalSymbols
|
|
154
153
|
/**
|
|
155
|
-
* Asserts that the value not matches with a
|
|
154
|
+
* Asserts that the value not matches with a queric query.
|
|
156
155
|
*/
|
|
157
156
|
notMatches(query) {
|
|
158
|
-
this.addTest((inAny,
|
|
159
|
-
yield chai_1.assert(!
|
|
157
|
+
this.addTest((inAny, target) => __awaiter(this, void 0, void 0, function* () {
|
|
158
|
+
yield (0, chai_1.assert)(!(0, queric_1.default)(query)(inAny), `${target} should not match with the queric query.`);
|
|
160
159
|
}));
|
|
161
160
|
return this.self();
|
|
162
161
|
}
|
|
@@ -167,8 +166,8 @@ class AbstractValueAsserter {
|
|
|
167
166
|
* @param keys
|
|
168
167
|
*/
|
|
169
168
|
containsAllKeys(...keys) {
|
|
170
|
-
this.addTest((value,
|
|
171
|
-
chai_1.assert.containsAllKeys(value, keys, `${
|
|
169
|
+
this.addTest((value, target) => {
|
|
170
|
+
chai_1.assert.containsAllKeys(value, keys, `${target} should contain all following keys: ${keys}.`);
|
|
172
171
|
});
|
|
173
172
|
return this.self();
|
|
174
173
|
}
|
|
@@ -179,8 +178,8 @@ class AbstractValueAsserter {
|
|
|
179
178
|
* @param keys
|
|
180
179
|
*/
|
|
181
180
|
hasAnyKeys(...keys) {
|
|
182
|
-
this.addTest((value,
|
|
183
|
-
chai_1.assert.hasAnyKeys(value, keys, `${
|
|
181
|
+
this.addTest((value, target) => {
|
|
182
|
+
chai_1.assert.hasAnyKeys(value, keys, `${target} should contain at least one of these keys: ${keys}.`);
|
|
184
183
|
});
|
|
185
184
|
return this.self();
|
|
186
185
|
}
|
|
@@ -191,8 +190,8 @@ class AbstractValueAsserter {
|
|
|
191
190
|
* @param keys
|
|
192
191
|
*/
|
|
193
192
|
doesNotHaveAnyKeys(...keys) {
|
|
194
|
-
this.addTest((value,
|
|
195
|
-
chai_1.assert.doesNotHaveAnyKeys(value, keys, `${
|
|
193
|
+
this.addTest((value, target) => {
|
|
194
|
+
chai_1.assert.doesNotHaveAnyKeys(value, keys, `${target} should not contain any of these keys: ${keys}.`);
|
|
196
195
|
});
|
|
197
196
|
return this.self();
|
|
198
197
|
}
|
|
@@ -205,8 +204,8 @@ class AbstractValueAsserter {
|
|
|
205
204
|
* @param subset
|
|
206
205
|
*/
|
|
207
206
|
ownInclude(subset) {
|
|
208
|
-
this.addTest((value,
|
|
209
|
-
chai_1.assert.ownInclude(value, subset, `${
|
|
207
|
+
this.addTest((value, target) => {
|
|
208
|
+
chai_1.assert.ownInclude(value, subset, `${target} should own include ${JSON.stringify(subset)}.`);
|
|
210
209
|
});
|
|
211
210
|
return this.self();
|
|
212
211
|
}
|
|
@@ -219,8 +218,8 @@ class AbstractValueAsserter {
|
|
|
219
218
|
* @param subset
|
|
220
219
|
*/
|
|
221
220
|
notOwnInclude(subset) {
|
|
222
|
-
this.addTest((value,
|
|
223
|
-
chai_1.assert.notOwnInclude(value, subset, `${
|
|
221
|
+
this.addTest((value, target) => {
|
|
222
|
+
chai_1.assert.notOwnInclude(value, subset, `${target} should not own include ${JSON.stringify(subset)}.`);
|
|
224
223
|
});
|
|
225
224
|
return this.self();
|
|
226
225
|
}
|
|
@@ -234,8 +233,8 @@ class AbstractValueAsserter {
|
|
|
234
233
|
* @param subset
|
|
235
234
|
*/
|
|
236
235
|
include(subset) {
|
|
237
|
-
this.addTest((value,
|
|
238
|
-
chai_1.assert.include(value, subset, `${
|
|
236
|
+
this.addTest((value, target) => {
|
|
237
|
+
chai_1.assert.include(value, subset, `${target} should include ${JSON.stringify(subset)}.`);
|
|
239
238
|
});
|
|
240
239
|
return this.self();
|
|
241
240
|
}
|
|
@@ -249,8 +248,8 @@ class AbstractValueAsserter {
|
|
|
249
248
|
* @param subset
|
|
250
249
|
*/
|
|
251
250
|
notInclude(subset) {
|
|
252
|
-
this.addTest((value,
|
|
253
|
-
chai_1.assert.notInclude(value, subset, `${
|
|
251
|
+
this.addTest((value, target) => {
|
|
252
|
+
chai_1.assert.notInclude(value, subset, `${target} should not include ${JSON.stringify(subset)}.`);
|
|
254
253
|
});
|
|
255
254
|
return this.self();
|
|
256
255
|
}
|
|
@@ -261,22 +260,19 @@ class AbstractValueAsserter {
|
|
|
261
260
|
* @param length
|
|
262
261
|
*/
|
|
263
262
|
lengthOf(length) {
|
|
264
|
-
this.addTest((value,
|
|
265
|
-
chai_1.assert.lengthOf(value, length, `${
|
|
263
|
+
this.addTest((value, target) => {
|
|
264
|
+
chai_1.assert.lengthOf(value, length, `${target} should have a length of ${length}.`);
|
|
266
265
|
});
|
|
267
266
|
return this.self();
|
|
268
267
|
}
|
|
269
268
|
// noinspection JSUnusedGlobalSymbols
|
|
270
269
|
/**
|
|
271
270
|
* @description
|
|
272
|
-
*
|
|
271
|
+
* Creates a custom assertion.
|
|
273
272
|
* @param assert
|
|
274
|
-
* @param message
|
|
275
273
|
*/
|
|
276
|
-
assert(assert
|
|
277
|
-
this.addTest((value,
|
|
278
|
-
chai_1.assert(yield assert(value), `${this.name + eStr}: ${message}`);
|
|
279
|
-
}));
|
|
274
|
+
assert(assert) {
|
|
275
|
+
this.addTest((value, target) => assert(value, target));
|
|
280
276
|
return this.self();
|
|
281
277
|
}
|
|
282
278
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AbstractValueAsserter } from "./abstractValueAsserter";
|
|
2
2
|
import { Test } from "../../test/test";
|
|
3
|
-
export declare class StandaloneValueAsserter extends AbstractValueAsserter<StandaloneValueAsserter
|
|
3
|
+
export declare class StandaloneValueAsserter<V> extends AbstractValueAsserter<V, StandaloneValueAsserter<V>> {
|
|
4
4
|
protected _test: Test;
|
|
5
|
-
constructor(value:
|
|
5
|
+
constructor(value: V, description?: string);
|
|
6
6
|
/**
|
|
7
7
|
* @description
|
|
8
8
|
* Run the test.
|
|
9
9
|
*/
|
|
10
10
|
test(): Promise<void>;
|
|
11
|
-
protected self(): StandaloneValueAsserter
|
|
11
|
+
protected self(): StandaloneValueAsserter<V>;
|
|
12
12
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
8
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -18,11 +18,11 @@ exports.StandaloneValueAsserter = void 0;
|
|
|
18
18
|
const abstractValueAsserter_1 = require("./abstractValueAsserter");
|
|
19
19
|
const test_1 = require("../../test/test");
|
|
20
20
|
class StandaloneValueAsserter extends abstractValueAsserter_1.AbstractValueAsserter {
|
|
21
|
-
constructor(value,
|
|
22
|
-
super(
|
|
23
|
-
this._test.test(() => test(value));
|
|
21
|
+
constructor(value, description) {
|
|
22
|
+
super((test) => {
|
|
23
|
+
this._test.test(() => test(value, 'Value'));
|
|
24
24
|
});
|
|
25
|
-
this._test = new test_1.Test(
|
|
25
|
+
this._test = new test_1.Test(description);
|
|
26
26
|
}
|
|
27
27
|
// noinspection JSUnusedGlobalSymbols
|
|
28
28
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { AbstractValueAsserter } from "./abstractValueAsserter";
|
|
2
|
-
declare type AddTest = (test: (value: any,
|
|
3
|
-
export declare class ValueAsserter<T> extends AbstractValueAsserter<ValueAsserter<T>> {
|
|
2
|
+
declare type AddTest = (test: (value: any, target: string) => void) => void;
|
|
3
|
+
export declare class ValueAsserter<V, T> extends AbstractValueAsserter<V, ValueAsserter<V, T>> {
|
|
4
4
|
protected readonly _source: T;
|
|
5
|
-
constructor(source: T,
|
|
5
|
+
constructor(source: T, addTest: AddTest);
|
|
6
6
|
/**
|
|
7
7
|
* @description
|
|
8
8
|
* End the value asserter.
|
|
9
9
|
*/
|
|
10
10
|
end(): T;
|
|
11
|
-
protected self(): ValueAsserter<T>;
|
|
11
|
+
protected self(): ValueAsserter<V, T>;
|
|
12
12
|
}
|
|
13
13
|
export {};
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.ValueAsserter = void 0;
|
|
9
9
|
const abstractValueAsserter_1 = require("./abstractValueAsserter");
|
|
10
10
|
class ValueAsserter extends abstractValueAsserter_1.AbstractValueAsserter {
|
|
11
|
-
constructor(source,
|
|
12
|
-
super(
|
|
11
|
+
constructor(source, addTest) {
|
|
12
|
+
super(addTest);
|
|
13
13
|
this._source = source;
|
|
14
14
|
}
|
|
15
15
|
// noinspection JSUnusedGlobalSymbols
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AbstractBackErrorsFilterBuilder, BackErrorFilter } from "zation-client";
|
|
2
|
+
export declare class BackErrorsFilterBuilder<T> extends AbstractBackErrorsFilterBuilder<BackErrorsFilterBuilder<T>> {
|
|
3
|
+
private readonly _source;
|
|
4
|
+
private readonly _filterCallback;
|
|
5
|
+
constructor(source: T, filterCallback: (filter: BackErrorFilter) => void);
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* Ends the filter builder.
|
|
9
|
+
*/
|
|
10
|
+
end(): T;
|
|
11
|
+
protected self(): BackErrorsFilterBuilder<T>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
|
+
GitHub: LucaCode
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.BackErrorsFilterBuilder = void 0;
|
|
9
|
+
const zation_client_1 = require("zation-client");
|
|
10
|
+
class BackErrorsFilterBuilder extends zation_client_1.AbstractBackErrorsFilterBuilder {
|
|
11
|
+
constructor(source, filterCallback) {
|
|
12
|
+
super();
|
|
13
|
+
this._source = source;
|
|
14
|
+
this._filterCallback = filterCallback;
|
|
15
|
+
}
|
|
16
|
+
// noinspection JSUnusedGlobalSymbols
|
|
17
|
+
/**
|
|
18
|
+
* @description
|
|
19
|
+
* Ends the filter builder.
|
|
20
|
+
*/
|
|
21
|
+
end() {
|
|
22
|
+
this._filterCallback(this.buildFilter() || {});
|
|
23
|
+
return this._source;
|
|
24
|
+
}
|
|
25
|
+
self() {
|
|
26
|
+
return this;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.BackErrorsFilterBuilder = BackErrorsFilterBuilder;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.Logger = void 0;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ApiLevelOption, ResponseTimeoutOption } from "zation-client";
|
|
2
|
+
import { ComplexTypesOption, BatchOption, SendTimeoutOption } from 'ziron-client';
|
|
3
|
+
export interface RequestOptions extends SendTimeoutOption, ApiLevelOption, ResponseTimeoutOption, BatchOption, ComplexTypesOption {
|
|
4
|
+
}
|
|
5
|
+
export interface ValidationRequestOptions extends SendTimeoutOption, ApiLevelOption, ResponseTimeoutOption, BatchOption, ComplexTypesOption {
|
|
6
|
+
}
|
|
7
|
+
export default interface TransmitOptions extends SendTimeoutOption, ApiLevelOption, BatchOption, ComplexTypesOption {
|
|
8
|
+
}
|
|
@@ -2,8 +2,8 @@ declare type Action = () => Promise<void> | void;
|
|
|
2
2
|
export declare class Test {
|
|
3
3
|
private readonly _subTests;
|
|
4
4
|
private currentSubTest;
|
|
5
|
-
private readonly
|
|
6
|
-
constructor(
|
|
5
|
+
private readonly _description?;
|
|
6
|
+
constructor(description?: string);
|
|
7
7
|
newSubTest(): void;
|
|
8
8
|
beforeTest(action: Action): void;
|
|
9
9
|
test(action: Action): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
8
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -17,9 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.Test = void 0;
|
|
18
18
|
const waitSymbol = Symbol();
|
|
19
19
|
class Test {
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(description) {
|
|
21
21
|
this._subTests = [];
|
|
22
|
-
this.
|
|
22
|
+
this._description = description;
|
|
23
23
|
this.newSubTest();
|
|
24
24
|
}
|
|
25
25
|
newSubTest() {
|
|
@@ -49,9 +49,11 @@ class Test {
|
|
|
49
49
|
}
|
|
50
50
|
execute() {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
if (this.
|
|
52
|
+
if (this._description != null) {
|
|
53
|
+
if (global['it'] == null)
|
|
54
|
+
throw new Error("Please install a test runner like mocha or jest.");
|
|
53
55
|
return new Promise((resolve, reject) => {
|
|
54
|
-
it(this.
|
|
56
|
+
global['it'](this._description, () => __awaiter(this, void 0, void 0, function* () {
|
|
55
57
|
try {
|
|
56
58
|
yield this._run();
|
|
57
59
|
resolve();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
8
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
import { Test } from "../test/test";
|
|
2
1
|
export default class ActionUtils {
|
|
3
2
|
/**
|
|
4
3
|
* @description
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Runs a test action and asserts that no error will be thrown.
|
|
5
|
+
* AssertionErrors will be rethrown, and all other errors will fail
|
|
6
|
+
* the test with the provided message or the concrete error.
|
|
8
7
|
* @param func
|
|
9
|
-
* @param failMsg
|
|
8
|
+
* @param failMsg If not provided, the concrete error is used.
|
|
10
9
|
*/
|
|
11
|
-
static
|
|
12
|
-
/**
|
|
13
|
-
* @description
|
|
14
|
-
* This function lets you do an extra action and
|
|
15
|
-
* asserts that an error or an error instance of a specific class is thrown.
|
|
16
|
-
* When no error is thrown, or the error does not match with the given classes
|
|
17
|
-
* (only if at least one class is given), it lets the test fail with the provided message.
|
|
18
|
-
* @param test
|
|
19
|
-
* @param func
|
|
20
|
-
* @param message
|
|
21
|
-
* @param validErrorClasses
|
|
22
|
-
*/
|
|
23
|
-
static actionShouldThrow(test: Test, func: () => void | Promise<void>, message: string, ...validErrorClasses: any[]): void;
|
|
10
|
+
static runAction(func: () => void | Promise<void>, failMsg?: string): Promise<void>;
|
|
24
11
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
8
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -14,57 +14,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const
|
|
17
|
+
const assert_1 = require("assert");
|
|
18
18
|
class ActionUtils {
|
|
19
19
|
// noinspection JSUnusedGlobalSymbols
|
|
20
20
|
/**
|
|
21
21
|
* @description
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* Runs a test action and asserts that no error will be thrown.
|
|
23
|
+
* AssertionErrors will be rethrown, and all other errors will fail
|
|
24
|
+
* the test with the provided message or the concrete error.
|
|
25
25
|
* @param func
|
|
26
|
-
* @param failMsg
|
|
26
|
+
* @param failMsg If not provided, the concrete error is used.
|
|
27
27
|
*/
|
|
28
|
-
static
|
|
29
|
-
|
|
28
|
+
static runAction(func, failMsg) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
30
|
try {
|
|
31
31
|
yield func();
|
|
32
32
|
}
|
|
33
|
-
catch (
|
|
34
|
-
|
|
33
|
+
catch (err) {
|
|
34
|
+
if (err instanceof assert_1.AssertionError)
|
|
35
|
+
throw err;
|
|
36
|
+
(0, assert_1.fail)(failMsg != null ? failMsg : err);
|
|
35
37
|
}
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
// noinspection JSUnusedGlobalSymbols
|
|
39
|
-
/**
|
|
40
|
-
* @description
|
|
41
|
-
* This function lets you do an extra action and
|
|
42
|
-
* asserts that an error or an error instance of a specific class is thrown.
|
|
43
|
-
* When no error is thrown, or the error does not match with the given classes
|
|
44
|
-
* (only if at least one class is given), it lets the test fail with the provided message.
|
|
45
|
-
* @param test
|
|
46
|
-
* @param func
|
|
47
|
-
* @param message
|
|
48
|
-
* @param validErrorClasses
|
|
49
|
-
*/
|
|
50
|
-
static actionShouldThrow(test, func, message, ...validErrorClasses) {
|
|
51
|
-
test.test(() => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
try {
|
|
53
|
-
yield func();
|
|
54
|
-
assert.fail(message);
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
let found = validErrorClasses.length === 0;
|
|
58
|
-
for (let i = 0; i < validErrorClasses.length; i++) {
|
|
59
|
-
if (e instanceof validErrorClasses[i]) {
|
|
60
|
-
found = true;
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (!found)
|
|
65
|
-
assert.fail(message);
|
|
66
|
-
}
|
|
67
|
-
}));
|
|
38
|
+
});
|
|
68
39
|
}
|
|
69
40
|
}
|
|
70
41
|
exports.default = ActionUtils;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Channel, Client, Databox, Response } from "zation-client";
|
|
2
|
+
export declare type ClientAPI<T extends Client<any, any>> = T extends Client<infer API, any> ? API : never;
|
|
3
|
+
export declare type ClientTokenPayload<T extends Client<any, any>> = T extends Client<any, infer TP> ? TP : never;
|
|
4
|
+
export declare type ResponseData<T extends Response<any>> = T extends Response<infer D> ? D : never;
|
|
5
|
+
export declare type DataboxData<T extends Databox<any, any, any, any>> = T extends Databox<infer D, any, any, any> ? D : never;
|
|
6
|
+
export declare type DataboxMember<T extends Databox<any, any, any, any>> = T extends Databox<any, infer M, any, any> ? M : never;
|
|
7
|
+
export declare type DataboxFetchData<T extends Databox<any, any, any, any>> = T extends Databox<any, any, any, infer F> ? F : never;
|
|
8
|
+
export declare type ChannelMember<T extends Channel<any, any>> = T extends Channel<infer M, any> ? M : never;
|
|
9
|
+
export declare type ChannelEvents<T extends Channel<any, any>> = T extends Channel<any, infer E> ? E : never;
|
|
10
|
+
export declare type Primitive = undefined | null | boolean | string | number | Function;
|
|
11
|
+
export declare type DeepReadonly<T> = T extends Primitive ? T : T extends Array<infer U> ? DeepReadonlyArray<U> : T extends Map<infer K, infer V> ? DeepReadonlyMap<K, V> : DeepReadonlyObject<T>;
|
|
12
|
+
interface DeepReadonlyArray<T> extends ReadonlyArray<DeepReadonly<T>> {
|
|
13
|
+
}
|
|
14
|
+
interface DeepReadonlyMap<K, V> extends ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> {
|
|
15
|
+
}
|
|
16
|
+
declare type DeepReadonlyObject<T> = {
|
|
17
|
+
readonly [K in keyof T]: DeepReadonly<T[K]>;
|
|
18
|
+
};
|
|
19
|
+
export declare type Default<T, D> = T extends undefined ? D : T;
|
|
20
|
+
export {};
|