zation-assured 0.6.3 → 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 +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 +5 -5
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.js +6 -6
- 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 +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 +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 +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 +7 -9
- 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,89 +0,0 @@
|
|
|
1
|
-
import { Channel, Databox, Client } from "zation-client";
|
|
2
|
-
import { Test } from "../test/test";
|
|
3
|
-
import { WhenBuilder } from "../../api/when";
|
|
4
|
-
import { ClientAsserter } from "./client/clientAsserter";
|
|
5
|
-
import { DataboxAsserter } from "./databox/databoxAsserter";
|
|
6
|
-
import { ChannelAsserter } from "./channel/channelAsserter";
|
|
7
|
-
export declare abstract class RootSendAsserter<T> {
|
|
8
|
-
protected readonly _test: Test;
|
|
9
|
-
protected readonly _client: Client;
|
|
10
|
-
private autoConnectedClient;
|
|
11
|
-
private _shouldThrowTimeoutError;
|
|
12
|
-
private _shouldThrowConnectionRequiredError;
|
|
13
|
-
protected constructor(test: Test, client: Client);
|
|
14
|
-
protected abstract _executeAction(): Promise<void>;
|
|
15
|
-
private _createTest;
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* Asserts that send should throw a timeout error.
|
|
19
|
-
* @param value
|
|
20
|
-
*/
|
|
21
|
-
throwsTimeoutError(value?: boolean): T;
|
|
22
|
-
/**
|
|
23
|
-
* @description
|
|
24
|
-
* Asserts that send should throw a connection required error.
|
|
25
|
-
* @param value
|
|
26
|
-
*/
|
|
27
|
-
throwsConnectionRequiredError(value?: boolean): T;
|
|
28
|
-
/**
|
|
29
|
-
* @description
|
|
30
|
-
* This function lets you do an extra action on the client and asserts that no error is thrown.
|
|
31
|
-
* When an error throws, it lets the test fail with the provided message or the concrete error.
|
|
32
|
-
* @param action
|
|
33
|
-
* @param message if not provided it throws the specific error.
|
|
34
|
-
*/
|
|
35
|
-
action(action: (client: Client) => void | Promise<void>, message?: string): T;
|
|
36
|
-
/**
|
|
37
|
-
* @description
|
|
38
|
-
* This function lets you do an extra action on the client and
|
|
39
|
-
* asserts that an error or an error instance of a specific class is thrown.
|
|
40
|
-
* When no error is thrown, or the error does not match with the given classes
|
|
41
|
-
* (only if at least one class is given), it lets the test fail with the provided message.
|
|
42
|
-
* @param action
|
|
43
|
-
* @param message
|
|
44
|
-
* @param validErrorClasses
|
|
45
|
-
*/
|
|
46
|
-
actionShouldThrow(action: (client: Client) => void | Promise<void>, message: string, ...validErrorClasses: any[]): T;
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* Start with a new when and link them to one test.
|
|
50
|
-
*/
|
|
51
|
-
and(): WhenBuilder;
|
|
52
|
-
/**
|
|
53
|
-
* @description
|
|
54
|
-
* Assert client.
|
|
55
|
-
*/
|
|
56
|
-
client(): ClientAsserter<T>;
|
|
57
|
-
/**
|
|
58
|
-
* @description
|
|
59
|
-
* Assert other clients.
|
|
60
|
-
* Notice that this method will not automatically connect the clients.
|
|
61
|
-
*/
|
|
62
|
-
otherClients(...clients: Client[]): ClientAsserter<T>;
|
|
63
|
-
/**
|
|
64
|
-
* @description
|
|
65
|
-
* Assert other databoxes.
|
|
66
|
-
* Notice that this method will not automatically connect the databoxes.
|
|
67
|
-
*/
|
|
68
|
-
otherDataboxes(...databoxes: Databox[]): DataboxAsserter<T>;
|
|
69
|
-
/**
|
|
70
|
-
* @description
|
|
71
|
-
* Assert other channels.
|
|
72
|
-
* Notice that this method will not automatically subscribe to the channels.
|
|
73
|
-
*/
|
|
74
|
-
otherChannels(...channels: Channel[]): ChannelAsserter<T>;
|
|
75
|
-
/**
|
|
76
|
-
* @description
|
|
77
|
-
* Runs the test.
|
|
78
|
-
* @param autoConnect
|
|
79
|
-
* Will auto connect the client
|
|
80
|
-
* if the client is not connected to the server.
|
|
81
|
-
*/
|
|
82
|
-
test(autoConnect?: boolean): Promise<void>;
|
|
83
|
-
/**
|
|
84
|
-
* @description
|
|
85
|
-
* Returns self.
|
|
86
|
-
* For fluent programing with inheritance.
|
|
87
|
-
*/
|
|
88
|
-
protected abstract self(): T;
|
|
89
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ZationClient } from 'zation-client';
|
|
2
|
-
import { AbstractClientAsserter } from "./abstractClientAsserter";
|
|
3
|
-
export declare class StandaloneClientAsserter extends AbstractClientAsserter<StandaloneClientAsserter> {
|
|
4
|
-
constructor(client: ZationClient | ZationClient[], itTestDescription?: string);
|
|
5
|
-
/**
|
|
6
|
-
* @description
|
|
7
|
-
* Run the test.
|
|
8
|
-
*/
|
|
9
|
-
test(): Promise<void>;
|
|
10
|
-
protected self(): StandaloneClientAsserter;
|
|
11
|
-
}
|
|
@@ -1,38 +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 abstractClientAsserter_1 = require("./abstractClientAsserter");
|
|
18
|
-
const test_1 = require("../test/test");
|
|
19
|
-
class StandaloneClientAsserter extends abstractClientAsserter_1.AbstractClientAsserter {
|
|
20
|
-
constructor(client, itTestDescription) {
|
|
21
|
-
let clients = Array.isArray(client) ? client : [client];
|
|
22
|
-
super(clients, new test_1.Test(itTestDescription));
|
|
23
|
-
}
|
|
24
|
-
// noinspection JSUnusedGlobalSymbols
|
|
25
|
-
/**
|
|
26
|
-
* @description
|
|
27
|
-
* Run the test.
|
|
28
|
-
*/
|
|
29
|
-
test() {
|
|
30
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
return this._test.execute();
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
self() {
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.StandaloneClientAsserter = StandaloneClientAsserter;
|
|
@@ -1,11 +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 assert = require('assert');
|
|
9
|
-
class ClientAssured {
|
|
10
|
-
}
|
|
11
|
-
exports.ClientAssured = ClientAssured;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestHelper, Zation as ZationClient } from "zation-client";
|
|
2
|
-
import { Test } from "../data/test";
|
|
3
|
-
import { WhenBuilder } from "../../api/when";
|
|
4
|
-
export declare class ResponseAssured {
|
|
5
|
-
private req;
|
|
6
|
-
private readonly _test;
|
|
7
|
-
private readonly client;
|
|
8
|
-
constructor(req: AbstractRequestHelper<any>, test: Test, client: ZationClient);
|
|
9
|
-
private _respInfo;
|
|
10
|
-
isSuccessful(): ResponseAssured;
|
|
11
|
-
notSuccessful(): ResponseAssured;
|
|
12
|
-
hasError(): ResponseAssured;
|
|
13
|
-
print(): ResponseAssured;
|
|
14
|
-
hasErrorCount(count: number): ResponseAssured;
|
|
15
|
-
and(): WhenBuilder;
|
|
16
|
-
test(autoConnect?: boolean): void;
|
|
17
|
-
}
|
|
@@ -1,72 +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
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
-
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
12
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
const when_1 = require("../../api/when");
|
|
17
|
-
const logger_1 = require("../console/logger");
|
|
18
|
-
const assert = require('assert');
|
|
19
|
-
class ResponseAssured {
|
|
20
|
-
constructor(req, test, client) {
|
|
21
|
-
this.req = req;
|
|
22
|
-
this._test = test;
|
|
23
|
-
this.client = client;
|
|
24
|
-
}
|
|
25
|
-
// noinspection JSMethodCanBeStatic
|
|
26
|
-
_respInfo(res) {
|
|
27
|
-
return '\n ' + res.toString();
|
|
28
|
-
}
|
|
29
|
-
isSuccessful() {
|
|
30
|
-
this.req.onResponse((res) => {
|
|
31
|
-
assert(res.isSuccessful(), 'Response should be successful.' + this._respInfo(res));
|
|
32
|
-
});
|
|
33
|
-
return this;
|
|
34
|
-
}
|
|
35
|
-
notSuccessful() {
|
|
36
|
-
this.req.onResponse((res) => {
|
|
37
|
-
assert(!res.isSuccessful(), 'Response should be not successful.' + this._respInfo(res));
|
|
38
|
-
});
|
|
39
|
-
return this;
|
|
40
|
-
}
|
|
41
|
-
hasError() {
|
|
42
|
-
this.req.onResponse((res) => {
|
|
43
|
-
assert(res.hasErrors(false), 'Response should have at least one error.' + this._respInfo(res));
|
|
44
|
-
});
|
|
45
|
-
return this;
|
|
46
|
-
}
|
|
47
|
-
print() {
|
|
48
|
-
this.req.onResponse((res) => {
|
|
49
|
-
logger_1.Logger.logInfo(res.toString());
|
|
50
|
-
});
|
|
51
|
-
return this;
|
|
52
|
-
}
|
|
53
|
-
hasErrorCount(count) {
|
|
54
|
-
this.req.onResponse((res) => {
|
|
55
|
-
assert(res.getErrors(false).length === count, `Response should have ${count} errors.` + this._respInfo(res));
|
|
56
|
-
});
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
and() {
|
|
60
|
-
return new when_1.WhenBuilder(this.client, this._test);
|
|
61
|
-
}
|
|
62
|
-
test(autoConnect = true) {
|
|
63
|
-
this._test.test(() => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
if (!this.client.isConnected() && autoConnect) {
|
|
65
|
-
yield this.client.connect();
|
|
66
|
-
}
|
|
67
|
-
yield this.req.send(false);
|
|
68
|
-
}));
|
|
69
|
-
this._test.execute();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.ResponseAssured = ResponseAssured;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { AbstractBackErrorFilterBuilder } from "zation-client";
|
|
2
|
-
import { ResponseAsserter } from "../asserter/controller/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
|
-
* Ends the filter builder.
|
|
10
|
-
*/
|
|
11
|
-
end(): T;
|
|
12
|
-
protected self(): BackErrorFilterBuilder<T>;
|
|
13
|
-
}
|
|
@@ -1,32 +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
|
-
exports.BackErrorFilterBuilder = void 0;
|
|
9
|
-
const zation_client_1 = require("zation-client");
|
|
10
|
-
class BackErrorFilterBuilder extends zation_client_1.AbstractBackErrorFilterBuilder {
|
|
11
|
-
constructor(respAsserter, count) {
|
|
12
|
-
super();
|
|
13
|
-
this.respAsserter = respAsserter;
|
|
14
|
-
this.count = count;
|
|
15
|
-
}
|
|
16
|
-
// noinspection JSUnusedGlobalSymbols
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* Ends the filter builder.
|
|
20
|
-
*/
|
|
21
|
-
end() {
|
|
22
|
-
if (this.count !== undefined)
|
|
23
|
-
this.respAsserter.hasErrorCount(this.count, this.buildFilter() || {});
|
|
24
|
-
else
|
|
25
|
-
this.respAsserter.hasError(this.buildFilter() || {});
|
|
26
|
-
return this.respAsserter;
|
|
27
|
-
}
|
|
28
|
-
self() {
|
|
29
|
-
return this;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.BackErrorFilterBuilder = BackErrorFilterBuilder;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder as NativeAbstractRequestBuilder, Client } from "zation-client";
|
|
2
|
-
import { Test } from "../../test/test";
|
|
3
|
-
import { ResponseAsserter } from "../../asserter/controller/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 nativeBuilder;
|
|
9
|
-
protected constructor(test: Test, client: Client, nativeBuilder: 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 client 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 assertions.
|
|
45
|
-
*/
|
|
46
|
-
assertThat(): ResponseAsserter;
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* Returns self.
|
|
50
|
-
* For fluent programing with inheritance.
|
|
51
|
-
*/
|
|
52
|
-
protected abstract self(): T;
|
|
53
|
-
}
|
|
@@ -1,69 +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
|
-
exports.AbstractRequestBuilder = void 0;
|
|
9
|
-
const responseAsserter_1 = require("../../asserter/controller/responseAsserter");
|
|
10
|
-
class AbstractRequestBuilder {
|
|
11
|
-
constructor(test, client, nativeBuilder) {
|
|
12
|
-
this.test = test;
|
|
13
|
-
this.client = client;
|
|
14
|
-
this.nativeBuilder = nativeBuilder;
|
|
15
|
-
}
|
|
16
|
-
// noinspection JSUnusedGlobalSymbols
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* Set the apiLevel of the request.
|
|
20
|
-
* @param apiLevel.
|
|
21
|
-
* @default undefined.
|
|
22
|
-
*/
|
|
23
|
-
apiLevel(apiLevel) {
|
|
24
|
-
this.nativeBuilder.apiLevel(apiLevel);
|
|
25
|
-
return this.self();
|
|
26
|
-
}
|
|
27
|
-
// noinspection JSUnusedGlobalSymbols
|
|
28
|
-
/**
|
|
29
|
-
* @description
|
|
30
|
-
* Set the timeout for the response of the request.
|
|
31
|
-
* Value can be null which means the timeout is disabled or
|
|
32
|
-
* undefined then it will use the default timeout of the client config,
|
|
33
|
-
* or it can be a number that indicates the milliseconds.
|
|
34
|
-
* @param timeout
|
|
35
|
-
*/
|
|
36
|
-
responseTimeout(timeout) {
|
|
37
|
-
this.nativeBuilder.responseTimeout(timeout);
|
|
38
|
-
return this.self();
|
|
39
|
-
}
|
|
40
|
-
// noinspection JSUnusedGlobalSymbols
|
|
41
|
-
/**
|
|
42
|
-
* With the ConnectTimeout option, you can activate that the socket is
|
|
43
|
-
* trying to connect when it is not connected. You have five possible choices:
|
|
44
|
-
* Undefined: It will use the value from the default options.
|
|
45
|
-
* False: The action will fail and throw a ConnectionRequiredError,
|
|
46
|
-
* when the socket is not connected.
|
|
47
|
-
* Null: The socket will try to connect (if it is not connected) and
|
|
48
|
-
* waits until the connection is made, then it continues the action.
|
|
49
|
-
* Number: Same as null, but now you can specify a timeout (in ms) of
|
|
50
|
-
* maximum waiting time for the connection. If the timeout is reached,
|
|
51
|
-
* it will throw a timeout error.
|
|
52
|
-
* AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
|
|
53
|
-
* @param timeout
|
|
54
|
-
* @default undefined
|
|
55
|
-
*/
|
|
56
|
-
connectTimeout(timeout) {
|
|
57
|
-
this.nativeBuilder.connectTimeout(timeout);
|
|
58
|
-
return this.self();
|
|
59
|
-
}
|
|
60
|
-
// noinspection JSUnusedGlobalSymbols
|
|
61
|
-
/**
|
|
62
|
-
* @description
|
|
63
|
-
* Start the assertions.
|
|
64
|
-
*/
|
|
65
|
-
assertThat() {
|
|
66
|
-
return new responseAsserter_1.ResponseAsserter(this.nativeBuilder, this.test, this.client);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.AbstractRequestBuilder = AbstractRequestBuilder;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
2
|
-
import { AuthRequestBuilder as NativeAuthRequestBuilder, Client } from "zation-client";
|
|
3
|
-
import { Test } from "../../test/test";
|
|
4
|
-
export declare class AuthRequestBuilder extends AbstractRequestBuilder<AuthRequestBuilder, NativeAuthRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeAuthRequestBuilder, test: Test, client: Client);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* Sets the authData of the request.
|
|
10
|
-
* @param data
|
|
11
|
-
* @default undefined
|
|
12
|
-
*/
|
|
13
|
-
authData(data: any): AuthRequestBuilder;
|
|
14
|
-
protected self(): AuthRequestBuilder;
|
|
15
|
-
}
|
|
@@ -1,30 +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
|
-
exports.AuthRequestBuilder = void 0;
|
|
9
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
10
|
-
class AuthRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
11
|
-
constructor(req, test, client) {
|
|
12
|
-
super(test, client, req);
|
|
13
|
-
this.req = req;
|
|
14
|
-
}
|
|
15
|
-
// noinspection JSUnusedGlobalSymbols
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* Sets the authData of the request.
|
|
19
|
-
* @param data
|
|
20
|
-
* @default undefined
|
|
21
|
-
*/
|
|
22
|
-
authData(data) {
|
|
23
|
-
this.req.authData(data);
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
self() {
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AuthRequestBuilder = AuthRequestBuilder;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { StandardRequestBuilder as NativeStandardRequestBuilder, Client } from "zation-client";
|
|
2
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
3
|
-
import { Test } from "../../test/test";
|
|
4
|
-
export declare class StandardRequestBuilder extends AbstractRequestBuilder<StandardRequestBuilder, NativeStandardRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeStandardRequestBuilder, test: Test, client: Client);
|
|
7
|
-
/**
|
|
8
|
-
* @description
|
|
9
|
-
* Sets the data of the request.
|
|
10
|
-
* @param data
|
|
11
|
-
* @default undefined
|
|
12
|
-
*/
|
|
13
|
-
data(data: any): StandardRequestBuilder;
|
|
14
|
-
protected self(): StandardRequestBuilder;
|
|
15
|
-
}
|
|
@@ -1,30 +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
|
-
exports.StandardRequestBuilder = void 0;
|
|
9
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
10
|
-
class StandardRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
11
|
-
constructor(req, test, client) {
|
|
12
|
-
super(test, client, req);
|
|
13
|
-
this.req = req;
|
|
14
|
-
}
|
|
15
|
-
// noinspection JSUnusedGlobalSymbols
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* Sets the data of the request.
|
|
19
|
-
* @param data
|
|
20
|
-
* @default undefined
|
|
21
|
-
*/
|
|
22
|
-
data(data) {
|
|
23
|
-
this.req.data(data);
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
self() {
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.StandardRequestBuilder = StandardRequestBuilder;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder } from "./abstractRequestBuilder";
|
|
2
|
-
import { ValidationCheckPair, ValidationCheckRequestBuilder as NativeValidationCheckRequestBuilder, Client } from "zation-client";
|
|
3
|
-
import { Test } from "../../test/test";
|
|
4
|
-
export declare class ValidationCheckRequestBuilder extends AbstractRequestBuilder<ValidationCheckRequestBuilder, NativeValidationCheckRequestBuilder> {
|
|
5
|
-
private req;
|
|
6
|
-
constructor(req: NativeValidationCheckRequestBuilder, test: Test, client: Client);
|
|
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,40 +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
|
-
exports.ValidationCheckRequestBuilder = void 0;
|
|
9
|
-
const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
|
|
10
|
-
class ValidationCheckRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
|
|
11
|
-
constructor(req, test, client) {
|
|
12
|
-
super(test, client, req);
|
|
13
|
-
this.req = req;
|
|
14
|
-
}
|
|
15
|
-
// noinspection JSUnusedGlobalSymbols
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* Adds validation checks.
|
|
19
|
-
* @param checks
|
|
20
|
-
*/
|
|
21
|
-
checks(...checks) {
|
|
22
|
-
this.req.checks(...checks);
|
|
23
|
-
return this;
|
|
24
|
-
}
|
|
25
|
-
// noinspection JSUnusedGlobalSymbols
|
|
26
|
-
/**
|
|
27
|
-
* @description
|
|
28
|
-
* Adds validation check.
|
|
29
|
-
* @param path
|
|
30
|
-
* @param value
|
|
31
|
-
*/
|
|
32
|
-
check(path, value) {
|
|
33
|
-
this.req.check(path, value);
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
self() {
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.ValidationCheckRequestBuilder = ValidationCheckRequestBuilder;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { PackageBuilder as NativePackageBuilder, Client } from "zation-client";
|
|
2
|
-
import { Test } from "../../test/test";
|
|
3
|
-
import { ConnectTimeoutOption } from "zation-client/dist/lib/main/utils/connectionUtils";
|
|
4
|
-
import { TransmitAsserter } from "../../asserter/receiver/transmitAsserter";
|
|
5
|
-
export declare class PackageBuilder {
|
|
6
|
-
private readonly test;
|
|
7
|
-
private readonly client;
|
|
8
|
-
private readonly natveBuilder;
|
|
9
|
-
constructor(nativeBuilder: NativePackageBuilder<any>, test: Test, client: Client);
|
|
10
|
-
/**
|
|
11
|
-
* @description
|
|
12
|
-
* Sets the data of the package.
|
|
13
|
-
* @param data
|
|
14
|
-
* @default undefined
|
|
15
|
-
*/
|
|
16
|
-
data(data: any): PackageBuilder;
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* Set the apiLevel of the package.
|
|
20
|
-
* @param apiLevel.
|
|
21
|
-
* @default undefined.
|
|
22
|
-
*/
|
|
23
|
-
apiLevel(apiLevel: number | undefined): PackageBuilder;
|
|
24
|
-
/**
|
|
25
|
-
* With the ConnectTimeout option, you can activate that the socket is
|
|
26
|
-
* trying to connect when it is not connected. You have five possible choices:
|
|
27
|
-
* Undefined: It will use the value from the default options.
|
|
28
|
-
* False: The action will fail and throw a ConnectionRequiredError,
|
|
29
|
-
* when the socket is not connected.
|
|
30
|
-
* Null: The socket will try to connect (if it is not connected) and
|
|
31
|
-
* waits until the connection is made, then it continues the action.
|
|
32
|
-
* Number: Same as null, but now you can specify a timeout (in ms) of
|
|
33
|
-
* maximum waiting time for the connection. If the timeout is reached,
|
|
34
|
-
* it will throw a timeout error.
|
|
35
|
-
* AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
|
|
36
|
-
* @param timeout
|
|
37
|
-
* @default undefined
|
|
38
|
-
*/
|
|
39
|
-
connectTimeout(timeout: ConnectTimeoutOption): PackageBuilder;
|
|
40
|
-
/**
|
|
41
|
-
* @description
|
|
42
|
-
* Start the assertions.
|
|
43
|
-
*/
|
|
44
|
-
assertThat(): TransmitAsserter;
|
|
45
|
-
}
|