zation-assured 3.0.0-dev.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/dist/lib/helper/asserter/channel/standaloneChannelAsserter.d.ts +1 -1
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.js +1 -1
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.d.ts +1 -1
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.js +1 -1
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.js +11 -1
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.d.ts +6 -1
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.js +17 -7
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.d.ts +1 -1
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.js +1 -1
- package/package.json +2 -3
|
@@ -9,7 +9,7 @@ export declare class StandaloneChannelAsserter<C extends Channel<any, any>> exte
|
|
|
9
9
|
subscribe(member?: any): StandaloneChannelAsserter<C>;
|
|
10
10
|
/**
|
|
11
11
|
* @description
|
|
12
|
-
*
|
|
12
|
+
* Runs the test.
|
|
13
13
|
*/
|
|
14
14
|
test(): Promise<void>;
|
|
15
15
|
protected self(): StandaloneChannelAsserter<C>;
|
|
@@ -43,7 +43,7 @@ class StandaloneChannelAsserter extends abstractChannelAsserter_1.AbstractChanne
|
|
|
43
43
|
// noinspection JSUnusedGlobalSymbols
|
|
44
44
|
/**
|
|
45
45
|
* @description
|
|
46
|
-
*
|
|
46
|
+
* Runs the test.
|
|
47
47
|
*/
|
|
48
48
|
test() {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -9,7 +9,7 @@ export declare class StandaloneClientAsserter<C extends Client<any, any>> extend
|
|
|
9
9
|
connect(): StandaloneClientAsserter<C>;
|
|
10
10
|
/**
|
|
11
11
|
* @description
|
|
12
|
-
*
|
|
12
|
+
* Runs the test.
|
|
13
13
|
*/
|
|
14
14
|
test(): Promise<void>;
|
|
15
15
|
protected self(): StandaloneClientAsserter<C>;
|
|
@@ -43,7 +43,7 @@ class StandaloneClientAsserter extends abstractClientAsserter_1.AbstractClientAs
|
|
|
43
43
|
// noinspection JSUnusedGlobalSymbols
|
|
44
44
|
/**
|
|
45
45
|
* @description
|
|
46
|
-
*
|
|
46
|
+
* Runs the test.
|
|
47
47
|
*/
|
|
48
48
|
test() {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,6 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.IntegratedResponseAsserter = void 0;
|
|
18
|
+
const zation_client_1 = require("zation-client");
|
|
18
19
|
const valueAsserter_1 = require("../value/valueAsserter");
|
|
19
20
|
const backErrorsFilterBuilder_1 = require("../../backError/backErrorsFilterBuilder");
|
|
20
21
|
const abstractActionAsserter_1 = require("../abstractActionAsserter");
|
|
@@ -27,7 +28,16 @@ class IntegratedResponseAsserter extends abstractActionAsserter_1.AbstractAction
|
|
|
27
28
|
}
|
|
28
29
|
_executeAction() {
|
|
29
30
|
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
|
|
31
|
+
let resp;
|
|
32
|
+
try {
|
|
33
|
+
resp = yield this.sendRequest();
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
if (err instanceof zation_client_1.Response)
|
|
37
|
+
resp = err;
|
|
38
|
+
else
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
31
41
|
for (let i = 0; i < this.responseAsserters.length; i++)
|
|
32
42
|
yield this.responseAsserters[i](resp);
|
|
33
43
|
});
|
|
@@ -3,7 +3,7 @@ import { ValueAsserter } from "../value/valueAsserter";
|
|
|
3
3
|
import { BackErrorsFilterBuilder } from "../../backError/backErrorsFilterBuilder";
|
|
4
4
|
import { ResponseData } from "../../utils/types";
|
|
5
5
|
export default class StandaloneResponseAsserter<R extends Response<any>> {
|
|
6
|
-
private readonly
|
|
6
|
+
private readonly _test;
|
|
7
7
|
private readonly responses;
|
|
8
8
|
constructor(response: R | R[], description?: string);
|
|
9
9
|
protected _forEachResponse(func: (response: R, i: number) => Promise<void> | void): Promise<void>;
|
|
@@ -46,4 +46,9 @@ export default class StandaloneResponseAsserter<R extends Response<any>> {
|
|
|
46
46
|
* @param assert
|
|
47
47
|
*/
|
|
48
48
|
assert(assert: (resp: R) => void | Promise<void>): StandaloneResponseAsserter<R>;
|
|
49
|
+
/**
|
|
50
|
+
* @description
|
|
51
|
+
* Runs the test.
|
|
52
|
+
*/
|
|
53
|
+
test(): Promise<void>;
|
|
49
54
|
}
|
|
@@ -20,7 +20,7 @@ const backErrorsFilterBuilder_1 = require("../../backError/backErrorsFilterBuild
|
|
|
20
20
|
const assert = require('assert');
|
|
21
21
|
class StandaloneResponseAsserter {
|
|
22
22
|
constructor(response, description) {
|
|
23
|
-
this.
|
|
23
|
+
this._test = new test_1.Test(description);
|
|
24
24
|
this.responses = Array.isArray(response) ? response : [response];
|
|
25
25
|
}
|
|
26
26
|
_forEachResponse(func) {
|
|
@@ -39,7 +39,7 @@ class StandaloneResponseAsserter {
|
|
|
39
39
|
* Asserts that the response is successful.
|
|
40
40
|
*/
|
|
41
41
|
isSuccessful() {
|
|
42
|
-
this.
|
|
42
|
+
this._test.test(() => this._forEachResponse((resp, i) => __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
assert(resp.successful, `Response: ${i} should be successful.` + this._respInfo(resp));
|
|
44
44
|
})));
|
|
45
45
|
return this;
|
|
@@ -50,7 +50,7 @@ class StandaloneResponseAsserter {
|
|
|
50
50
|
* Asserts that the response is not successful.
|
|
51
51
|
*/
|
|
52
52
|
isNotSuccessful() {
|
|
53
|
-
this.
|
|
53
|
+
this._test.test(() => this._forEachResponse((resp, i) => __awaiter(this, void 0, void 0, function* () {
|
|
54
54
|
assert(!resp.successful, `Response: ${i} should be not successful.` + this._respInfo(resp));
|
|
55
55
|
})));
|
|
56
56
|
return this;
|
|
@@ -61,7 +61,7 @@ class StandaloneResponseAsserter {
|
|
|
61
61
|
* Asserts that the response has a result.
|
|
62
62
|
*/
|
|
63
63
|
hasResult() {
|
|
64
|
-
this.
|
|
64
|
+
this._test.test(() => this._forEachResponse((resp, i) => __awaiter(this, void 0, void 0, function* () {
|
|
65
65
|
assert(resp.result != null, `Response: ${i} should have a result.`
|
|
66
66
|
+ this._respInfo(resp));
|
|
67
67
|
})));
|
|
@@ -74,14 +74,14 @@ class StandaloneResponseAsserter {
|
|
|
74
74
|
*/
|
|
75
75
|
result() {
|
|
76
76
|
return new valueAsserter_1.ValueAsserter(this, (test) => {
|
|
77
|
-
this.
|
|
77
|
+
this._test.test(() => this._forEachResponse((resp, i) => __awaiter(this, void 0, void 0, function* () {
|
|
78
78
|
test(resp.result, `response: ${i} result`);
|
|
79
79
|
})));
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
hasError(filter) {
|
|
83
83
|
if (filter !== undefined) {
|
|
84
|
-
this.
|
|
84
|
+
this._test.test(() => this._forEachResponse((resp, i) => __awaiter(this, void 0, void 0, function* () {
|
|
85
85
|
assert(resp.filter(filter).length > 0, `Response: ${i} should have at least one back error that matches the filter: ${JSON.stringify(filter)}.`
|
|
86
86
|
+ this._respInfo(resp));
|
|
87
87
|
})));
|
|
@@ -99,10 +99,20 @@ class StandaloneResponseAsserter {
|
|
|
99
99
|
* @param assert
|
|
100
100
|
*/
|
|
101
101
|
assert(assert) {
|
|
102
|
-
this.
|
|
102
|
+
this._test.test(() => this._forEachResponse((resp) => __awaiter(this, void 0, void 0, function* () {
|
|
103
103
|
yield assert(resp);
|
|
104
104
|
})));
|
|
105
105
|
return this;
|
|
106
106
|
}
|
|
107
|
+
// noinspection JSUnusedGlobalSymbols
|
|
108
|
+
/**
|
|
109
|
+
* @description
|
|
110
|
+
* Runs the test.
|
|
111
|
+
*/
|
|
112
|
+
test() {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
return this._test.execute();
|
|
115
|
+
});
|
|
116
|
+
}
|
|
107
117
|
}
|
|
108
118
|
exports.default = StandaloneResponseAsserter;
|
|
@@ -10,7 +10,7 @@ export declare class StandaloneDataboxAsserter<D extends Databox<any, any, any,
|
|
|
10
10
|
connect(member?: DataboxMember<D>): StandaloneDataboxAsserter<D>;
|
|
11
11
|
/**
|
|
12
12
|
* @description
|
|
13
|
-
*
|
|
13
|
+
* Runs the test.
|
|
14
14
|
*/
|
|
15
15
|
test(): Promise<void>;
|
|
16
16
|
protected self(): StandaloneDataboxAsserter<D>;
|
|
@@ -43,7 +43,7 @@ class StandaloneDataboxAsserter extends abstractDataboxAsserter_1.AbstractDatabo
|
|
|
43
43
|
// noinspection JSUnusedGlobalSymbols
|
|
44
44
|
/**
|
|
45
45
|
* @description
|
|
46
|
-
*
|
|
46
|
+
* Runs the test.
|
|
47
47
|
*/
|
|
48
48
|
test() {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zation-assured",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Library For Testing Zation Servers",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"prepublishOnly": "npm run build",
|
|
10
|
-
"build": "gulp compile"
|
|
11
|
-
"test": "nyc --reporter=html mocha -- ./test/**/*.test.js"
|
|
10
|
+
"build": "gulp compile"
|
|
12
11
|
},
|
|
13
12
|
"repository": {
|
|
14
13
|
"type": "git",
|