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,41 +0,0 @@
|
|
|
1
|
-
import { Test } from "../test/test";
|
|
2
|
-
import { ZationClient } from 'zation-client';
|
|
3
|
-
import { AnyAsserter } from "./anyAsserter";
|
|
4
|
-
export declare type Responder = (resp: (err?: (any | number), responseData?: any) => void, data: any) => void;
|
|
5
|
-
export declare class EventAsserter<T> {
|
|
6
|
-
protected readonly _test: Test;
|
|
7
|
-
protected readonly _clients: ZationClient[];
|
|
8
|
-
protected readonly _source: T;
|
|
9
|
-
protected readonly _event: string;
|
|
10
|
-
protected readonly _responder: Responder;
|
|
11
|
-
private readonly _dataChecker;
|
|
12
|
-
private _timeout;
|
|
13
|
-
private _not;
|
|
14
|
-
constructor(clients: ZationClient[], event: string, test: Test, source: T, responder?: Responder);
|
|
15
|
-
/**
|
|
16
|
-
* @description
|
|
17
|
-
* With this function, you can set a time limit in that the event should receive.
|
|
18
|
-
* @default
|
|
19
|
-
* The default value is 0.
|
|
20
|
-
*/
|
|
21
|
-
timeout(timeout: number): EventAsserter<T>;
|
|
22
|
-
/**
|
|
23
|
-
* @description
|
|
24
|
-
* With this function, you set that the client should not receive the event.
|
|
25
|
-
* @default
|
|
26
|
-
* The default value is false.
|
|
27
|
-
*/
|
|
28
|
-
not(): EventAsserter<T>;
|
|
29
|
-
/**
|
|
30
|
-
* @description
|
|
31
|
-
* Assert the received data.
|
|
32
|
-
* Notice that the data will not checked in (get not) mode.
|
|
33
|
-
*/
|
|
34
|
-
assertData(): AnyAsserter<EventAsserter<T>>;
|
|
35
|
-
private _checkData;
|
|
36
|
-
/**
|
|
37
|
-
* @description
|
|
38
|
-
* End the event asserter.
|
|
39
|
-
*/
|
|
40
|
-
end(): T;
|
|
41
|
-
}
|
|
@@ -1,115 +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 timeoutAssert_1 = require("../timeout/timeoutAssert");
|
|
18
|
-
const anyAsserter_1 = require("./anyAsserter");
|
|
19
|
-
const assert = require('assert');
|
|
20
|
-
class EventAsserter {
|
|
21
|
-
constructor(clients, event, test, source, responder = () => {
|
|
22
|
-
}) {
|
|
23
|
-
this._dataChecker = [];
|
|
24
|
-
this._timeout = 0;
|
|
25
|
-
this._not = false;
|
|
26
|
-
this._clients = clients;
|
|
27
|
-
this._event = event;
|
|
28
|
-
this._test = test;
|
|
29
|
-
this._source = source;
|
|
30
|
-
this._responder = responder;
|
|
31
|
-
}
|
|
32
|
-
// noinspection JSUnusedGlobalSymbols
|
|
33
|
-
/**
|
|
34
|
-
* @description
|
|
35
|
-
* With this function, you can set a time limit in that the event should receive.
|
|
36
|
-
* @default
|
|
37
|
-
* The default value is 0.
|
|
38
|
-
*/
|
|
39
|
-
timeout(timeout) {
|
|
40
|
-
this._timeout = timeout;
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
// noinspection JSUnusedGlobalSymbols
|
|
44
|
-
/**
|
|
45
|
-
* @description
|
|
46
|
-
* With this function, you set that the client should not receive the event.
|
|
47
|
-
* @default
|
|
48
|
-
* The default value is false.
|
|
49
|
-
*/
|
|
50
|
-
not() {
|
|
51
|
-
this._not = true;
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
// noinspection JSUnusedGlobalSymbols
|
|
55
|
-
/**
|
|
56
|
-
* @description
|
|
57
|
-
* Assert the received data.
|
|
58
|
-
* Notice that the data will not checked in (get not) mode.
|
|
59
|
-
*/
|
|
60
|
-
assertData() {
|
|
61
|
-
return new anyAsserter_1.AnyAsserter(this, '', (test) => {
|
|
62
|
-
this._dataChecker.push(test);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
_checkData(data, clientIndex) {
|
|
66
|
-
this._dataChecker.forEach((f) => {
|
|
67
|
-
f(data, `Client: ${clientIndex} event: ${this._event} -> Received data `);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
// noinspection JSUnusedGlobalSymbols
|
|
71
|
-
/**
|
|
72
|
-
* @description
|
|
73
|
-
* End the event asserter.
|
|
74
|
-
*/
|
|
75
|
-
end() {
|
|
76
|
-
this._clients.forEach((c, i) => {
|
|
77
|
-
let receivedEmit = false;
|
|
78
|
-
let data;
|
|
79
|
-
let resolve;
|
|
80
|
-
this._test.beforeTest(() => {
|
|
81
|
-
c.once(this._event, (d, res) => {
|
|
82
|
-
this._responder(res, d);
|
|
83
|
-
data = d;
|
|
84
|
-
receivedEmit = true;
|
|
85
|
-
if (typeof resolve === 'function') {
|
|
86
|
-
resolve();
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
const failMsg = `Client: ${i} should ${this._not ? 'not ' : ''}receive the event: ${this._event} from the server.`;
|
|
91
|
-
this._test.test(() => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
if (!receivedEmit) {
|
|
93
|
-
const toa = new timeoutAssert_1.TimeoutAssert(failMsg, this._timeout, this._not);
|
|
94
|
-
resolve = () => {
|
|
95
|
-
toa.resolve();
|
|
96
|
-
};
|
|
97
|
-
yield toa.set();
|
|
98
|
-
if (!this._not && toa.isSuccess()) {
|
|
99
|
-
this._checkData(data, i);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
if (!this._not) {
|
|
104
|
-
this._checkData(data, i);
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
assert.fail(failMsg);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}));
|
|
111
|
-
});
|
|
112
|
-
return this._source;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.EventAsserter = EventAsserter;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ForintQuery } from "forint";
|
|
2
|
-
declare type AddTest = (test: (obj: any, eStr?: string) => void) => void;
|
|
3
|
-
export default class ObjectAsserter<T> {
|
|
4
|
-
protected readonly self: T;
|
|
5
|
-
private readonly addTest;
|
|
6
|
-
private readonly name;
|
|
7
|
-
constructor(self: T, name: string, addTest: AddTest);
|
|
8
|
-
/**
|
|
9
|
-
* @description
|
|
10
|
-
* Assert that the object has all specific keys or more.
|
|
11
|
-
* @param keys
|
|
12
|
-
*/
|
|
13
|
-
containsAllKeys(...keys: string[]): ObjectAsserter<T>;
|
|
14
|
-
/**
|
|
15
|
-
* @description
|
|
16
|
-
* Assert that the object has at least one specific key or more.
|
|
17
|
-
* @param keys
|
|
18
|
-
*/
|
|
19
|
-
hasAnyKeys(...keys: string[]): ObjectAsserter<T>;
|
|
20
|
-
/**
|
|
21
|
-
* @description
|
|
22
|
-
* Assert that the object is deepEqual with...
|
|
23
|
-
* @param obj
|
|
24
|
-
*/
|
|
25
|
-
deepEqual(obj: any): ObjectAsserter<T>;
|
|
26
|
-
/**
|
|
27
|
-
* @description
|
|
28
|
-
* Assert that the object own includes...
|
|
29
|
-
* Can be used to assert the inclusion of a subset of properties
|
|
30
|
-
* in an object while ignoring inherited properties.
|
|
31
|
-
* @example
|
|
32
|
-
* ownInclude({id : 10});
|
|
33
|
-
* @param obj
|
|
34
|
-
*/
|
|
35
|
-
ownInclude(obj: any): ObjectAsserter<T>;
|
|
36
|
-
/**
|
|
37
|
-
* Asserts that object matches with a forint query.
|
|
38
|
-
*/
|
|
39
|
-
matches(query: ForintQuery): ObjectAsserter<T>;
|
|
40
|
-
/**
|
|
41
|
-
* @description
|
|
42
|
-
* With this function you can create custom assertions for object.
|
|
43
|
-
* @param assert
|
|
44
|
-
* function with params
|
|
45
|
-
* -obj the input
|
|
46
|
-
* -name the name of this assertion.
|
|
47
|
-
*/
|
|
48
|
-
assert(assert: (obj: any, name: string) => void | Promise<void>): ObjectAsserter<T>;
|
|
49
|
-
/**
|
|
50
|
-
* @description
|
|
51
|
-
* End the object asserter.
|
|
52
|
-
*/
|
|
53
|
-
end(): T;
|
|
54
|
-
}
|
|
55
|
-
export {};
|
|
@@ -1,113 +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 forint_1 = require("forint");
|
|
18
|
-
const cAssert = require('chai').assert;
|
|
19
|
-
class ObjectAsserter {
|
|
20
|
-
constructor(self, name, addTest) {
|
|
21
|
-
this.self = self;
|
|
22
|
-
this.addTest = addTest;
|
|
23
|
-
this.name = name;
|
|
24
|
-
}
|
|
25
|
-
// noinspection JSUnusedGlobalSymbols
|
|
26
|
-
/**
|
|
27
|
-
* @description
|
|
28
|
-
* Assert that the object has all specific keys or more.
|
|
29
|
-
* @param keys
|
|
30
|
-
*/
|
|
31
|
-
containsAllKeys(...keys) {
|
|
32
|
-
this.addTest((obj, eStr = '') => {
|
|
33
|
-
cAssert.containsAllKeys(obj, keys, `${this.name + eStr} should contains ${keys} as keys.`);
|
|
34
|
-
});
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
|
-
// noinspection JSUnusedGlobalSymbols
|
|
38
|
-
/**
|
|
39
|
-
* @description
|
|
40
|
-
* Assert that the object has at least one specific key or more.
|
|
41
|
-
* @param keys
|
|
42
|
-
*/
|
|
43
|
-
hasAnyKeys(...keys) {
|
|
44
|
-
this.addTest((obj, eStr = '') => {
|
|
45
|
-
cAssert.hasAnyKeys(obj, keys, `${this.name + eStr} should contains at least one of these keys: ${keys}.`);
|
|
46
|
-
});
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
// noinspection JSUnusedGlobalSymbols
|
|
50
|
-
/**
|
|
51
|
-
* @description
|
|
52
|
-
* Assert that the object is deepEqual with...
|
|
53
|
-
* @param obj
|
|
54
|
-
*/
|
|
55
|
-
deepEqual(obj) {
|
|
56
|
-
this.addTest((inObj, eStr = '') => {
|
|
57
|
-
// noinspection TypeScriptValidateJSTypes
|
|
58
|
-
cAssert.deepEqual(inObj, obj, `${this.name + eStr} should deep equal with ${JSON.stringify(obj)}`);
|
|
59
|
-
});
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
// noinspection JSUnusedGlobalSymbols
|
|
63
|
-
/**
|
|
64
|
-
* @description
|
|
65
|
-
* Assert that the object own includes...
|
|
66
|
-
* Can be used to assert the inclusion of a subset of properties
|
|
67
|
-
* in an object while ignoring inherited properties.
|
|
68
|
-
* @example
|
|
69
|
-
* ownInclude({id : 10});
|
|
70
|
-
* @param obj
|
|
71
|
-
*/
|
|
72
|
-
ownInclude(obj) {
|
|
73
|
-
this.addTest((inObj, eStr = '') => {
|
|
74
|
-
// noinspection TypeScriptValidateJSTypes
|
|
75
|
-
cAssert.ownInclude(inObj, obj, `${this.name + eStr} should own include ${JSON.stringify(obj)}`);
|
|
76
|
-
});
|
|
77
|
-
return this;
|
|
78
|
-
}
|
|
79
|
-
// noinspection JSUnusedGlobalSymbols
|
|
80
|
-
/**
|
|
81
|
-
* Asserts that object matches with a forint query.
|
|
82
|
-
*/
|
|
83
|
-
matches(query) {
|
|
84
|
-
this.addTest((inObj, eStr = '') => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
yield cAssert(forint_1.default(query)(inObj), `${this.name + eStr} should match with the forint query.`);
|
|
86
|
-
}));
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
// noinspection JSUnusedGlobalSymbols
|
|
90
|
-
/**
|
|
91
|
-
* @description
|
|
92
|
-
* With this function you can create custom assertions for object.
|
|
93
|
-
* @param assert
|
|
94
|
-
* function with params
|
|
95
|
-
* -obj the input
|
|
96
|
-
* -name the name of this assertion.
|
|
97
|
-
*/
|
|
98
|
-
assert(assert) {
|
|
99
|
-
this.addTest((inObj, eStr = '') => __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
yield assert(inObj, (this.name + eStr));
|
|
101
|
-
}));
|
|
102
|
-
return this;
|
|
103
|
-
}
|
|
104
|
-
// noinspection JSUnusedGlobalSymbols
|
|
105
|
-
/**
|
|
106
|
-
* @description
|
|
107
|
-
* End the object asserter.
|
|
108
|
-
*/
|
|
109
|
-
end() {
|
|
110
|
-
return this.self;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
exports.default = ObjectAsserter;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PackageBuilder as NativePackageBuilder, Client } from "zation-client";
|
|
2
|
-
import { Test } from "../../test/test";
|
|
3
|
-
import { RootSendAsserter } from "../rootSendAsserter";
|
|
4
|
-
export declare class TransmitAsserter extends RootSendAsserter<TransmitAsserter> {
|
|
5
|
-
private nativeBuilder;
|
|
6
|
-
constructor(nativeBuilder: NativePackageBuilder<any>, test: Test, client: Client);
|
|
7
|
-
protected _executeAction(): Promise<void>;
|
|
8
|
-
protected self(): TransmitAsserter;
|
|
9
|
-
}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { AbstractRequestBuilder as NativeAbstractRequestBuilder, ZationClient, Response, BackErrorFilter } from "zation-client";
|
|
2
|
-
import { Test } from "../test/test";
|
|
3
|
-
import { WhenBuilder } from "../../api/when";
|
|
4
|
-
import { AnyAsserter } from "./anyAsserter";
|
|
5
|
-
import { BackErrorFilterBuilder } from "../backError/backErrorFilterBuilder";
|
|
6
|
-
import { ClientAsserter } from "./clientAsserter";
|
|
7
|
-
export declare class ResponseAsserter {
|
|
8
|
-
private req;
|
|
9
|
-
private readonly _test;
|
|
10
|
-
private readonly _client;
|
|
11
|
-
private autoConnectedClient;
|
|
12
|
-
private _shouldThrowTimeoutError;
|
|
13
|
-
private _shouldThrowConnectionRequiredError;
|
|
14
|
-
constructor(req: NativeAbstractRequestBuilder<any>, test: Test, client: ZationClient);
|
|
15
|
-
private _createTest;
|
|
16
|
-
private _respInfo;
|
|
17
|
-
/**
|
|
18
|
-
* @description
|
|
19
|
-
* Assert that send the request should throw a timeout error.
|
|
20
|
-
* @param value
|
|
21
|
-
*/
|
|
22
|
-
throwsTimeoutError(value?: boolean): ResponseAsserter;
|
|
23
|
-
/**
|
|
24
|
-
* @description
|
|
25
|
-
* Assert that send the request should throw a connection required error.
|
|
26
|
-
* @param value
|
|
27
|
-
*/
|
|
28
|
-
throwsConnectionRequiredError(value?: boolean): ResponseAsserter;
|
|
29
|
-
/**
|
|
30
|
-
* @description
|
|
31
|
-
* Assert that the response is successful.
|
|
32
|
-
*/
|
|
33
|
-
isSuccessful(): ResponseAsserter;
|
|
34
|
-
/**
|
|
35
|
-
* @description
|
|
36
|
-
* Assert that the response is not successful.
|
|
37
|
-
*/
|
|
38
|
-
isNotSuccessful(): ResponseAsserter;
|
|
39
|
-
/**
|
|
40
|
-
* @description
|
|
41
|
-
* Assert that the response has a result.
|
|
42
|
-
*/
|
|
43
|
-
hasResult(): ResponseAsserter;
|
|
44
|
-
/**
|
|
45
|
-
* @description
|
|
46
|
-
* Assert the result of the response.
|
|
47
|
-
*/
|
|
48
|
-
assertResult(): AnyAsserter<ResponseAsserter>;
|
|
49
|
-
/**
|
|
50
|
-
* @description
|
|
51
|
-
* Print the complete response to the console.
|
|
52
|
-
*/
|
|
53
|
-
print(): ResponseAsserter;
|
|
54
|
-
/**
|
|
55
|
-
* @description
|
|
56
|
-
* Assert that the response has a specific count of errors.
|
|
57
|
-
* @param count
|
|
58
|
-
* count of errors
|
|
59
|
-
* @param filter
|
|
60
|
-
* Filter to filter for specific errors.
|
|
61
|
-
*/
|
|
62
|
-
hasErrorCount(count: number, ...filter: BackErrorFilter[]): ResponseAsserter;
|
|
63
|
-
/**
|
|
64
|
-
* @description
|
|
65
|
-
* Assert that the response has count of specific errors
|
|
66
|
-
* with filter builder.
|
|
67
|
-
* @param count
|
|
68
|
-
* count of errors
|
|
69
|
-
*/
|
|
70
|
-
buildHasErrorCount(count: number): BackErrorFilterBuilder<ResponseAsserter>;
|
|
71
|
-
/**
|
|
72
|
-
* @description
|
|
73
|
-
* Assert that the response has an specific error
|
|
74
|
-
* with filter builder.
|
|
75
|
-
*/
|
|
76
|
-
hasError(): BackErrorFilterBuilder<ResponseAsserter>;
|
|
77
|
-
/**
|
|
78
|
-
* @description
|
|
79
|
-
* Assert that the response has an error.
|
|
80
|
-
* @param filter
|
|
81
|
-
* Filter to filter for specific errors.
|
|
82
|
-
*/
|
|
83
|
-
hasError(...filter: BackErrorFilter[]): ResponseAsserter;
|
|
84
|
-
private static _filterErrors;
|
|
85
|
-
/**
|
|
86
|
-
* @description
|
|
87
|
-
* With this function you can create custom assertions for a response.
|
|
88
|
-
* @param assert
|
|
89
|
-
* The assert function with params:
|
|
90
|
-
* -res The response
|
|
91
|
-
*/
|
|
92
|
-
assert(assert: (resp: Response) => void | Promise<void>): ResponseAsserter;
|
|
93
|
-
/**
|
|
94
|
-
* @description
|
|
95
|
-
* With this function, you can do extra things in the test.
|
|
96
|
-
* Subscribe a channel, publish to a channel...
|
|
97
|
-
* @param func
|
|
98
|
-
* @param failMsg if not provided it throws the specific error.
|
|
99
|
-
*/
|
|
100
|
-
do(func: () => void | Promise<void>, failMsg?: string): ResponseAsserter;
|
|
101
|
-
/**
|
|
102
|
-
* @description
|
|
103
|
-
* With this function, you can do extra things in the test
|
|
104
|
-
* and assert that it should throw an error or a specific error.
|
|
105
|
-
* Subscribe a channel, publish to a channel...
|
|
106
|
-
* @param func
|
|
107
|
-
* @param failMsg
|
|
108
|
-
* @param errors
|
|
109
|
-
*/
|
|
110
|
-
doShouldThrow(func: () => void | Promise<void>, failMsg: string, ...errors: any[]): ResponseAsserter;
|
|
111
|
-
/**
|
|
112
|
-
* @description
|
|
113
|
-
* Start with a new request and link them to one test.
|
|
114
|
-
*/
|
|
115
|
-
and(): WhenBuilder;
|
|
116
|
-
/**
|
|
117
|
-
* @description
|
|
118
|
-
* Run the test.
|
|
119
|
-
* @param autoConnect
|
|
120
|
-
* Will auto connect the client
|
|
121
|
-
* if the client is not connected to the server.
|
|
122
|
-
*/
|
|
123
|
-
test(autoConnect?: boolean): Promise<void>;
|
|
124
|
-
/**
|
|
125
|
-
* @description
|
|
126
|
-
* Assert zation clients after request.
|
|
127
|
-
*/
|
|
128
|
-
client(...client: ZationClient[]): ClientAsserter<ResponseAsserter>;
|
|
129
|
-
}
|