zation-assured 0.5.1 → 3.0.0-dev.1
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 +16 -9
- package/dist/lib/api/assert.js +16 -12
- 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 +24 -33
- package/dist/lib/helper/asserter/channel/abstractChannelAsserter.js +48 -89
- 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 +5 -5
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.js +6 -6
- package/dist/lib/helper/asserter/client/abstractClientAsserter.d.ts +29 -47
- package/dist/lib/helper/asserter/client/abstractClientAsserter.js +91 -193
- 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 +5 -5
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.js +6 -6
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.d.ts +52 -0
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.js +112 -0
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.d.ts +49 -0
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.js +108 -0
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.d.ts +33 -40
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.js +48 -84
- 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 +6 -5
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.js +6 -6
- 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 +10 -12
- package/dist/lib/helper/asserter/value/abstractValueAsserter.js +46 -50
- 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 +8 -10
- 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 -76
- package/dist/lib/helper/asserter/controller/responseAsserter.js +0 -154
- 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 -35
- 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,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const assert = require('assert');
|
|
18
|
-
class ActionUtils {
|
|
19
|
-
// noinspection JSUnusedGlobalSymbols
|
|
20
|
-
/**
|
|
21
|
-
* @description
|
|
22
|
-
* This function lets you do an extra action and asserts that no error is thrown.
|
|
23
|
-
* When an error throws, it lets the test fail with the provided message or the concrete error.
|
|
24
|
-
* @param test
|
|
25
|
-
* @param func
|
|
26
|
-
* @param failMsg if not provided it throws the specific error.
|
|
27
|
-
*/
|
|
28
|
-
static action(test, func, failMsg) {
|
|
29
|
-
test.test(() => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
try {
|
|
31
|
-
yield func();
|
|
32
|
-
}
|
|
33
|
-
catch (e) {
|
|
34
|
-
assert.fail(failMsg !== undefined ? failMsg : e);
|
|
35
|
-
}
|
|
36
|
-
}), true);
|
|
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
|
-
}), true);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.default = ActionUtils;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Test } from "../test/test";
|
|
2
|
-
export default class DoUtils {
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* With this function, you can do extra things in the test.
|
|
6
|
-
* It asserts that the do-function will not throw an error.
|
|
7
|
-
* Subscribe a channel, publish to a channel...
|
|
8
|
-
* @param test
|
|
9
|
-
* @param func
|
|
10
|
-
* @param failMsg if not provided it throws the specific error.
|
|
11
|
-
*/
|
|
12
|
-
static do(test: Test, func: () => void | Promise<void>, failMsg?: string): void;
|
|
13
|
-
/**
|
|
14
|
-
* @description
|
|
15
|
-
* With this function, you can do extra things in the test
|
|
16
|
-
* and assert that it should throw an error or a specific error.
|
|
17
|
-
* Subscribe a channel, publish to a channel...
|
|
18
|
-
* @param test
|
|
19
|
-
* @param func
|
|
20
|
-
* @param failMsg
|
|
21
|
-
* @param errors
|
|
22
|
-
*/
|
|
23
|
-
static doShouldThrow(test: Test, func: () => void | Promise<void>, failMsg: string, ...errors: any[]): void;
|
|
24
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
const assert = require('assert');
|
|
18
|
-
class DoUtils {
|
|
19
|
-
// noinspection JSUnusedGlobalSymbols
|
|
20
|
-
/**
|
|
21
|
-
* @description
|
|
22
|
-
* With this function, you can do extra things in the test.
|
|
23
|
-
* It asserts that the do-function will not throw an error.
|
|
24
|
-
* Subscribe a channel, publish to a channel...
|
|
25
|
-
* @param test
|
|
26
|
-
* @param func
|
|
27
|
-
* @param failMsg if not provided it throws the specific error.
|
|
28
|
-
*/
|
|
29
|
-
static do(test, func, failMsg) {
|
|
30
|
-
test.test(() => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
try {
|
|
32
|
-
yield func();
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
if (failMsg !== undefined) {
|
|
36
|
-
assert.fail(failMsg);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
throw e;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}), true);
|
|
43
|
-
}
|
|
44
|
-
// noinspection JSUnusedGlobalSymbols
|
|
45
|
-
/**
|
|
46
|
-
* @description
|
|
47
|
-
* With this function, you can do extra things in the test
|
|
48
|
-
* and assert that it should throw an error or a specific error.
|
|
49
|
-
* Subscribe a channel, publish to a channel...
|
|
50
|
-
* @param test
|
|
51
|
-
* @param func
|
|
52
|
-
* @param failMsg
|
|
53
|
-
* @param errors
|
|
54
|
-
*/
|
|
55
|
-
static doShouldThrow(test, func, failMsg, ...errors) {
|
|
56
|
-
test.test(() => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
let throws = false;
|
|
58
|
-
try {
|
|
59
|
-
yield func();
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
throws = true;
|
|
63
|
-
let found = errors.length === 0;
|
|
64
|
-
for (let i = 0; i < errors.length; i++) {
|
|
65
|
-
if (e instanceof errors[i]) {
|
|
66
|
-
found = true;
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (!found) {
|
|
71
|
-
assert.fail(failMsg);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
if (!throws) {
|
|
75
|
-
assert.fail(failMsg);
|
|
76
|
-
}
|
|
77
|
-
}), true);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.default = DoUtils;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AbstractBackErrorFilterBuilder } from "zation-client";
|
|
2
|
-
import { ResponseAsserter } from "./../asserter/responseAsserter";
|
|
3
|
-
export declare class BackErrorFilterBuilder<T extends ResponseAsserter> extends AbstractBackErrorFilterBuilder<BackErrorFilterBuilder<T>> {
|
|
4
|
-
private readonly respAsserter;
|
|
5
|
-
private readonly count;
|
|
6
|
-
constructor(respAsserter: T, count?: number);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* End the filter builder.
|
|
10
|
-
*/
|
|
11
|
-
end(): T;
|
|
12
|
-
protected self(): BackErrorFilterBuilder<T>;
|
|
13
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const zation_client_1 = require("zation-client");
|
|
9
|
-
class BackErrorFilterBuilder extends zation_client_1.AbstractBackErrorFilterBuilder {
|
|
10
|
-
constructor(respAsserter, count) {
|
|
11
|
-
super();
|
|
12
|
-
this.respAsserter = respAsserter;
|
|
13
|
-
this.count = count;
|
|
14
|
-
}
|
|
15
|
-
// noinspection JSUnusedGlobalSymbols
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* End the filter builder.
|
|
19
|
-
*/
|
|
20
|
-
end() {
|
|
21
|
-
this._pushTmpFilter();
|
|
22
|
-
if (this.count) {
|
|
23
|
-
this.respAsserter.hasErrorCount(this.count, ...this.filter);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.respAsserter.hasError(...this.filter);
|
|
27
|
-
}
|
|
28
|
-
return this.respAsserter;
|
|
29
|
-
}
|
|
30
|
-
self() {
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.BackErrorFilterBuilder = BackErrorFilterBuilder;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AbstractErrorFilterBuilder } from "zation-client";
|
|
2
|
-
import { ResponseAsserter } from "./../asserter/responseAsserter";
|
|
3
|
-
export declare class TaskErrorFilterBuilder<T extends ResponseAsserter> extends AbstractErrorFilterBuilder<TaskErrorFilterBuilder<T>> {
|
|
4
|
-
private readonly respAsserter;
|
|
5
|
-
private readonly count;
|
|
6
|
-
constructor(respAsserter: T, count?: number);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* End the filter builder.
|
|
10
|
-
*/
|
|
11
|
-
end(): T;
|
|
12
|
-
protected self(): TaskErrorFilterBuilder<T>;
|
|
13
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const zation_client_1 = require("zation-client");
|
|
9
|
-
class TaskErrorFilterBuilder extends zation_client_1.AbstractErrorFilterBuilder {
|
|
10
|
-
constructor(respAsserter, count) {
|
|
11
|
-
super();
|
|
12
|
-
this.respAsserter = respAsserter;
|
|
13
|
-
this.count = count;
|
|
14
|
-
}
|
|
15
|
-
// noinspection JSUnusedGlobalSymbols
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* End the filter builder.
|
|
19
|
-
*/
|
|
20
|
-
end() {
|
|
21
|
-
this._pushTmpFilter();
|
|
22
|
-
if (this.count) {
|
|
23
|
-
this.respAsserter.hasErrorCount(this.count, ...this.filter);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
this.respAsserter.hasError(...this.filter);
|
|
27
|
-
}
|
|
28
|
-
return this.respAsserter;
|
|
29
|
-
}
|
|
30
|
-
self() {
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.TaskErrorFilterBuilder = TaskErrorFilterBuilder;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder as NativeAbstractRequestBuilder, Zation as ZationClient } from "zation-client";
|
|
2
|
-
import { Test } from "../data/test";
|
|
3
|
-
import { ResponseAsserter } from "../asserter/responseAsserter";
|
|
4
|
-
import { ConnectTimeoutOption } from "zation-client/dist/lib/main/utils/connectionUtils";
|
|
5
|
-
export declare abstract class AbstractRequestBuilder<T, RT> {
|
|
6
|
-
private readonly test;
|
|
7
|
-
private readonly client;
|
|
8
|
-
private readonly abReq;
|
|
9
|
-
protected constructor(test: Test, client: ZationClient, req: NativeAbstractRequestBuilder<any>);
|
|
10
|
-
/**
|
|
11
|
-
* @description
|
|
12
|
-
* Set the apiLevel of the request.
|
|
13
|
-
* @param apiLevel.
|
|
14
|
-
* @default undefined.
|
|
15
|
-
*/
|
|
16
|
-
apiLevel(apiLevel: number | undefined): T;
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* Set the timeout for the response of the request.
|
|
20
|
-
* Value can be null which means the timeout is disabled or
|
|
21
|
-
* undefined then it will use the default timeout of the zation config,
|
|
22
|
-
* or it can be a number that indicates the milliseconds.
|
|
23
|
-
* @param timeout
|
|
24
|
-
*/
|
|
25
|
-
responseTimeout(timeout: null | undefined | number): T;
|
|
26
|
-
/**
|
|
27
|
-
* With the ConnectTimeout option, you can activate that the socket is
|
|
28
|
-
* trying to connect when it is not connected. You have five possible choices:
|
|
29
|
-
* Undefined: It will use the value from the default options.
|
|
30
|
-
* False: The action will fail and throw a ConnectionRequiredError,
|
|
31
|
-
* when the socket is not connected.
|
|
32
|
-
* Null: The socket will try to connect (if it is not connected) and
|
|
33
|
-
* waits until the connection is made, then it continues the action.
|
|
34
|
-
* Number: Same as null, but now you can specify a timeout (in ms) of
|
|
35
|
-
* maximum waiting time for the connection. If the timeout is reached,
|
|
36
|
-
* it will throw a timeout error.
|
|
37
|
-
* AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
|
|
38
|
-
* @param timeout
|
|
39
|
-
* @default undefined
|
|
40
|
-
*/
|
|
41
|
-
connectTimeout(timeout: ConnectTimeoutOption): T;
|
|
42
|
-
/**
|
|
43
|
-
* @description
|
|
44
|
-
* Start the assert that part
|
|
45
|
-
*/
|
|
46
|
-
assertThat(): ResponseAsserter;
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* Returns self.
|
|
50
|
-
* For fluent programing with inheritance.
|
|
51
|
-
*/
|
|
52
|
-
protected abstract self(): T;
|
|
53
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const responseAsserter_1 = require("../asserter/responseAsserter");
|
|
9
|
-
class AbstractRequestBuilder {
|
|
10
|
-
constructor(test, client, req) {
|
|
11
|
-
this.test = test;
|
|
12
|
-
this.client = client;
|
|
13
|
-
this.abReq = req;
|
|
14
|
-
}
|
|
15
|
-
// noinspection JSUnusedGlobalSymbols
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* Set the apiLevel of the request.
|
|
19
|
-
* @param apiLevel.
|
|
20
|
-
* @default undefined.
|
|
21
|
-
*/
|
|
22
|
-
apiLevel(apiLevel) {
|
|
23
|
-
this.abReq.apiLevel(apiLevel);
|
|
24
|
-
return this.self();
|
|
25
|
-
}
|
|
26
|
-
// noinspection JSUnusedGlobalSymbols
|
|
27
|
-
/**
|
|
28
|
-
* @description
|
|
29
|
-
* Set the timeout for the response of the request.
|
|
30
|
-
* Value can be null which means the timeout is disabled or
|
|
31
|
-
* undefined then it will use the default timeout of the zation config,
|
|
32
|
-
* or it can be a number that indicates the milliseconds.
|
|
33
|
-
* @param timeout
|
|
34
|
-
*/
|
|
35
|
-
responseTimeout(timeout) {
|
|
36
|
-
this.abReq.responseTimeout(timeout);
|
|
37
|
-
return this.self();
|
|
38
|
-
}
|
|
39
|
-
// noinspection JSUnusedGlobalSymbols
|
|
40
|
-
/**
|
|
41
|
-
* With the ConnectTimeout option, you can activate that the socket is
|
|
42
|
-
* trying to connect when it is not connected. You have five possible choices:
|
|
43
|
-
* Undefined: It will use the value from the default options.
|
|
44
|
-
* False: The action will fail and throw a ConnectionRequiredError,
|
|
45
|
-
* when the socket is not connected.
|
|
46
|
-
* Null: The socket will try to connect (if it is not connected) and
|
|
47
|
-
* waits until the connection is made, then it continues the action.
|
|
48
|
-
* Number: Same as null, but now you can specify a timeout (in ms) of
|
|
49
|
-
* maximum waiting time for the connection. If the timeout is reached,
|
|
50
|
-
* it will throw a timeout error.
|
|
51
|
-
* AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
|
|
52
|
-
* @param timeout
|
|
53
|
-
* @default undefined
|
|
54
|
-
*/
|
|
55
|
-
connectTimeout(timeout) {
|
|
56
|
-
this.abReq.connectTimeout(timeout);
|
|
57
|
-
return this.self();
|
|
58
|
-
}
|
|
59
|
-
// noinspection JSUnusedGlobalSymbols
|
|
60
|
-
/**
|
|
61
|
-
* @description
|
|
62
|
-
* Start the assert that part
|
|
63
|
-
*/
|
|
64
|
-
assertThat() {
|
|
65
|
-
return new responseAsserter_1.ResponseAsserter(this.abReq, this.test, this.client);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.AbstractRequestBuilder = AbstractRequestBuilder;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
2
|
-
import { AuthRequestBuilder as NativeAuthRequestBuilder, Zation as ZationClient } from "zation-client";
|
|
3
|
-
import { Test } from "../data/test";
|
|
4
|
-
export declare class AuthRequestBuilder extends AbstractRequestBuilder<AuthRequestBuilder, NativeAuthRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeAuthRequestBuilder, test: Test, client: ZationClient);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* Set the authData of the request.
|
|
10
|
-
* @param data
|
|
11
|
-
* @default undefined (equals to {} on server param based input).
|
|
12
|
-
*/
|
|
13
|
-
authData(data: any): AuthRequestBuilder;
|
|
14
|
-
protected self(): AuthRequestBuilder;
|
|
15
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
9
|
-
class AuthRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
10
|
-
constructor(req, test, client) {
|
|
11
|
-
super(test, client, req);
|
|
12
|
-
this.req = req;
|
|
13
|
-
}
|
|
14
|
-
// noinspection JSUnusedGlobalSymbols
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* Set the authData of the request.
|
|
18
|
-
* @param data
|
|
19
|
-
* @default undefined (equals to {} on server param based input).
|
|
20
|
-
*/
|
|
21
|
-
authData(data) {
|
|
22
|
-
this.req.authData(data);
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
self() {
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.AuthRequestBuilder = AuthRequestBuilder;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { RequestBuilder as NativeRequestBuilder, Zation as ZationClient } from "zation-client";
|
|
2
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
3
|
-
import { Test } from "../data/test";
|
|
4
|
-
export declare class RequestBuilder extends AbstractRequestBuilder<RequestBuilder, NativeRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeRequestBuilder, test: Test, client: ZationClient);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* Set request should use authentication if it is an http request and client is authenticated.
|
|
10
|
-
* @param useAuth
|
|
11
|
-
* @default true
|
|
12
|
-
*/
|
|
13
|
-
useAuth(useAuth: boolean): RequestBuilder;
|
|
14
|
-
/**
|
|
15
|
-
* @description
|
|
16
|
-
* Set the controller of the request.
|
|
17
|
-
* @param controller
|
|
18
|
-
* @default ''
|
|
19
|
-
*/
|
|
20
|
-
controller(controller: string): RequestBuilder;
|
|
21
|
-
/**
|
|
22
|
-
* @description
|
|
23
|
-
* Set is systemController of the request.
|
|
24
|
-
* @default false
|
|
25
|
-
* @param isSystemController
|
|
26
|
-
*/
|
|
27
|
-
systemController(isSystemController: boolean): RequestBuilder;
|
|
28
|
-
/**
|
|
29
|
-
* @description
|
|
30
|
-
* Set the data of the request.
|
|
31
|
-
* @param data
|
|
32
|
-
* @default undefined (equals to {} on server param based input).
|
|
33
|
-
*/
|
|
34
|
-
data(data: any): RequestBuilder;
|
|
35
|
-
/**
|
|
36
|
-
* @description
|
|
37
|
-
* Attach http content to http request.
|
|
38
|
-
* The attached http content will only used by post requests.
|
|
39
|
-
* Can be used for attaching files.
|
|
40
|
-
* @param key
|
|
41
|
-
* @param data
|
|
42
|
-
* @default []
|
|
43
|
-
*/
|
|
44
|
-
attachHttpContent(key: string, data: string | Blob): RequestBuilder;
|
|
45
|
-
protected self(): RequestBuilder;
|
|
46
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
9
|
-
class RequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
10
|
-
constructor(req, test, client) {
|
|
11
|
-
super(test, client, req);
|
|
12
|
-
this.req = req;
|
|
13
|
-
}
|
|
14
|
-
// noinspection JSUnusedGlobalSymbols
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* Set request should use authentication if it is an http request and client is authenticated.
|
|
18
|
-
* @param useAuth
|
|
19
|
-
* @default true
|
|
20
|
-
*/
|
|
21
|
-
useAuth(useAuth) {
|
|
22
|
-
this.req.useAuth(useAuth);
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
// noinspection JSUnusedGlobalSymbols
|
|
26
|
-
/**
|
|
27
|
-
* @description
|
|
28
|
-
* Set the controller of the request.
|
|
29
|
-
* @param controller
|
|
30
|
-
* @default ''
|
|
31
|
-
*/
|
|
32
|
-
controller(controller) {
|
|
33
|
-
this.req.controller(controller);
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
// noinspection JSUnusedGlobalSymbols
|
|
37
|
-
/**
|
|
38
|
-
* @description
|
|
39
|
-
* Set is systemController of the request.
|
|
40
|
-
* @default false
|
|
41
|
-
* @param isSystemController
|
|
42
|
-
*/
|
|
43
|
-
systemController(isSystemController) {
|
|
44
|
-
this.req.systemController(isSystemController);
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
// noinspection JSUnusedGlobalSymbols
|
|
48
|
-
/**
|
|
49
|
-
* @description
|
|
50
|
-
* Set the data of the request.
|
|
51
|
-
* @param data
|
|
52
|
-
* @default undefined (equals to {} on server param based input).
|
|
53
|
-
*/
|
|
54
|
-
data(data) {
|
|
55
|
-
this.req.data(data);
|
|
56
|
-
return this;
|
|
57
|
-
}
|
|
58
|
-
// noinspection JSUnusedGlobalSymbols
|
|
59
|
-
/**
|
|
60
|
-
* @description
|
|
61
|
-
* Attach http content to http request.
|
|
62
|
-
* The attached http content will only used by post requests.
|
|
63
|
-
* Can be used for attaching files.
|
|
64
|
-
* @param key
|
|
65
|
-
* @param data
|
|
66
|
-
* @default []
|
|
67
|
-
*/
|
|
68
|
-
attachHttpContent(key, data) {
|
|
69
|
-
this.req.attachHttpContent(key, data);
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
self() {
|
|
73
|
-
return this;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
exports.RequestBuilder = RequestBuilder;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StandardRequestBuilder as NativeStandardRequestBuilder, Zation as ZationClient } from "zation-client";
|
|
2
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
3
|
-
import { Test } from "../data/test";
|
|
4
|
-
export declare class StandardRequestBuilder extends AbstractRequestBuilder<StandardRequestBuilder, NativeStandardRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeStandardRequestBuilder, test: Test, client: ZationClient);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* Set the data of the request.
|
|
10
|
-
* @param data
|
|
11
|
-
* @default undefined (equals to {} on server param based input).
|
|
12
|
-
*/
|
|
13
|
-
data(data: any): StandardRequestBuilder;
|
|
14
|
-
protected self(): StandardRequestBuilder;
|
|
15
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
9
|
-
class StandardRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
10
|
-
constructor(req, test, client) {
|
|
11
|
-
super(test, client, req);
|
|
12
|
-
this.req = req;
|
|
13
|
-
}
|
|
14
|
-
// noinspection JSUnusedGlobalSymbols
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* Set the data of the request.
|
|
18
|
-
* @param data
|
|
19
|
-
* @default undefined (equals to {} on server param based input).
|
|
20
|
-
*/
|
|
21
|
-
data(data) {
|
|
22
|
-
this.req.data(data);
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
self() {
|
|
26
|
-
return this;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.StandardRequestBuilder = StandardRequestBuilder;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
2
|
-
import { ValidationCheckPair, ValidationCheckRequestBuilder as NativeValidationCheckRequestBuilder, Zation as ZationClient } from "zation-client";
|
|
3
|
-
import { Test } from "../data/test";
|
|
4
|
-
export declare class ValidationCheckRequestBuilder extends AbstractRequestBuilder<ValidationCheckRequestBuilder, NativeValidationCheckRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeValidationCheckRequestBuilder, test: Test, client: ZationClient);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* Adds validation checks.
|
|
10
|
-
* @param checks
|
|
11
|
-
*/
|
|
12
|
-
checks(...checks: ValidationCheckPair[]): ValidationCheckRequestBuilder;
|
|
13
|
-
/**
|
|
14
|
-
* @description
|
|
15
|
-
* Adds validation check.
|
|
16
|
-
* @param path
|
|
17
|
-
* @param value
|
|
18
|
-
*/
|
|
19
|
-
check(path: string | string[], value: any): ValidationCheckRequestBuilder;
|
|
20
|
-
protected self(): ValidationCheckRequestBuilder;
|
|
21
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
4
|
-
GitHub: LucaCode
|
|
5
|
-
©Copyright by Luca Scaringella
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
9
|
-
class ValidationCheckRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
10
|
-
constructor(req, test, client) {
|
|
11
|
-
super(test, client, req);
|
|
12
|
-
this.req = req;
|
|
13
|
-
}
|
|
14
|
-
// noinspection JSUnusedGlobalSymbols
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* Adds validation checks.
|
|
18
|
-
* @param checks
|
|
19
|
-
*/
|
|
20
|
-
checks(...checks) {
|
|
21
|
-
this.req.checks(...checks);
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
// noinspection JSUnusedGlobalSymbols
|
|
25
|
-
/**
|
|
26
|
-
* @description
|
|
27
|
-
* Adds validation check.
|
|
28
|
-
* @param path
|
|
29
|
-
* @param value
|
|
30
|
-
*/
|
|
31
|
-
check(path, value) {
|
|
32
|
-
this.req.check(path, value);
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
self() {
|
|
36
|
-
return this;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
exports.ValidationCheckRequestBuilder = ValidationCheckRequestBuilder;
|