zation-assured 0.6.2 → 3.0.0-beta.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 +4 -2
- package/README.md +56 -2
- package/dist/index.d.ts +2 -3
- package/dist/index.js +8 -14
- package/dist/lib/api/assert.d.ts +21 -14
- package/dist/lib/api/assert.js +17 -13
- package/dist/lib/api/testHelper.d.ts +0 -8
- package/dist/lib/api/testHelper.js +6 -83
- package/dist/lib/api/when.d.ts +42 -45
- package/dist/lib/api/when.js +42 -55
- package/dist/lib/helper/asserter/abstractActionAsserter.d.ts +68 -0
- package/dist/lib/helper/asserter/{rootSendAsserter.js → abstractActionAsserter.js} +23 -67
- package/dist/lib/helper/asserter/assertStarter.d.ts +5 -0
- package/dist/lib/helper/asserter/assertStarter.js +16 -0
- package/dist/lib/helper/asserter/channel/abstractChannelAsserter.d.ts +20 -29
- package/dist/lib/helper/asserter/channel/abstractChannelAsserter.js +44 -85
- package/dist/lib/helper/asserter/channel/channelAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/channel/channelAsserter.js +2 -2
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.d.ts +6 -6
- package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.js +7 -7
- package/dist/lib/helper/asserter/client/abstractClientAsserter.d.ts +20 -38
- package/dist/lib/helper/asserter/client/abstractClientAsserter.js +82 -184
- package/dist/lib/helper/asserter/client/clientAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/client/clientAsserter.js +2 -2
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.d.ts +6 -6
- package/dist/lib/helper/asserter/client/standaloneClientAsserter.js +7 -7
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.d.ts +52 -0
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.js +122 -0
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.d.ts +54 -0
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.js +118 -0
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.d.ts +29 -36
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.js +44 -80
- package/dist/lib/helper/asserter/databox/databoxAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/databox/databoxAsserter.js +2 -2
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.d.ts +7 -6
- package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.js +7 -7
- package/dist/lib/helper/asserter/event/abstractEventAsserter.d.ts +13 -5
- package/dist/lib/helper/asserter/event/abstractEventAsserter.js +25 -10
- package/dist/lib/helper/asserter/event/codeMetadataEventAsserter.d.ts +21 -0
- package/dist/lib/helper/asserter/event/codeMetadataEventAsserter.js +47 -0
- package/dist/lib/helper/asserter/event/dataEventAsserter.d.ts +13 -3
- package/dist/lib/helper/asserter/event/dataEventAsserter.js +22 -4
- package/dist/lib/helper/asserter/receiver/integratedTransmitAsserter.d.ts +9 -0
- package/dist/lib/helper/asserter/receiver/{transmitAsserter.js → integratedTransmitAsserter.js} +9 -9
- package/dist/lib/helper/asserter/value/abstractValueAsserter.d.ts +13 -15
- package/dist/lib/helper/asserter/value/abstractValueAsserter.js +49 -53
- package/dist/lib/helper/asserter/value/standaloneValueAsserter.d.ts +3 -3
- package/dist/lib/helper/asserter/value/standaloneValueAsserter.js +6 -6
- package/dist/lib/helper/asserter/value/valueAsserter.d.ts +4 -4
- package/dist/lib/helper/asserter/value/valueAsserter.js +4 -4
- package/dist/lib/helper/backError/backErrorsFilterBuilder.d.ts +12 -0
- package/dist/lib/helper/backError/backErrorsFilterBuilder.js +29 -0
- package/dist/lib/helper/console/logger.js +2 -2
- package/dist/lib/helper/definitions/optionTypes.d.ts +8 -0
- package/dist/lib/helper/definitions/optionTypes.js +7 -0
- package/dist/lib/helper/test/test.d.ts +3 -3
- 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 +16 -14
- 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
package/LICENSE
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2018 Ing. Luca Gian Scaringella
|
|
4
|
+
|
|
5
|
+
This MIT license applies only to zation-assured.
|
|
4
6
|
|
|
5
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
8
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
20
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
21
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
22
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
23
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,2 +1,56 @@
|
|
|
1
|
-
# zation-assured
|
|
2
|
-
Library
|
|
1
|
+
# zation-assured ✔
|
|
2
|
+
*Library for testing zation servers.*
|
|
3
|
+
|
|
4
|
+
<h1 align="center">
|
|
5
|
+
<!-- Logo -->
|
|
6
|
+
<br/>
|
|
7
|
+
<a href="https://github.com/ZationServer">
|
|
8
|
+
<img src="https://raw.githubusercontent.com/ZationServer/zation/master/assets/logo/zationWideLogoDark.svg" alt="Logo Zation" height="200"/>
|
|
9
|
+
</a>
|
|
10
|
+
<br/>
|
|
11
|
+
</h1>
|
|
12
|
+
|
|
13
|
+
<h1 align="center">
|
|
14
|
+
<!-- Stability -->
|
|
15
|
+
<a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
|
|
16
|
+
<img src="https://img.shields.io/badge/stability-stable-brightgreen.svg" alt="API Stability"/>
|
|
17
|
+
</a>
|
|
18
|
+
<!-- TypeScript -->
|
|
19
|
+
<a href="http://typescriptlang.org">
|
|
20
|
+
<img src="https://img.shields.io/badge/%3C%2F%3E-typescript-blue.svg" alt="TypeScript"/>
|
|
21
|
+
</a>
|
|
22
|
+
<!-- Downloads -->
|
|
23
|
+
<a href="https://npmjs.org/package/zation-assured">
|
|
24
|
+
<img src="https://img.shields.io/npm/dm/zation-assured.svg" alt="Downloads"/>
|
|
25
|
+
</a>
|
|
26
|
+
<!-- Size -->
|
|
27
|
+
<a href="https://npmjs.org/package/zation-assured">
|
|
28
|
+
<img src="https://img.shields.io/bundlephobia/min/zation-assured.svg" alt="Size"/>
|
|
29
|
+
</a>
|
|
30
|
+
</h1>
|
|
31
|
+
|
|
32
|
+
## License
|
|
33
|
+
|
|
34
|
+
MIT License
|
|
35
|
+
|
|
36
|
+
Copyright (c) 2018 Ing. Luca Gian Scaringella
|
|
37
|
+
|
|
38
|
+
This MIT license applies only to zation-assured.
|
|
39
|
+
|
|
40
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
41
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
42
|
+
in the Software without restriction, including without limitation the rights
|
|
43
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
44
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
45
|
+
furnished to do so, subject to the following conditions:
|
|
46
|
+
|
|
47
|
+
The above copyright notice and this permission notice shall be included in all
|
|
48
|
+
copies or substantial portions of the Software.
|
|
49
|
+
|
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
51
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
52
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
53
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
54
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
55
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
56
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ClientOptions, Client, create } from "zation-client";
|
|
2
1
|
import { when } from "./lib/api/when";
|
|
3
|
-
import {
|
|
2
|
+
import { failTest as fail } from "./lib/api/testHelper";
|
|
4
3
|
import { assert } from "./lib/api/assert";
|
|
5
4
|
export * from 'zation-client';
|
|
6
|
-
export {
|
|
5
|
+
export { when, assert, fail };
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
8
|
if (k2 === undefined) k2 = k;
|
|
9
|
-
Object.
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
10
14
|
}) : (function(o, m, k, k2) {
|
|
11
15
|
if (k2 === undefined) k2 = k;
|
|
12
16
|
o[k2] = m[k];
|
|
@@ -15,20 +19,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
20
|
};
|
|
17
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
19
|
-
//Api Classes
|
|
20
|
-
const zation_client_1 = require("zation-client");
|
|
21
|
-
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return zation_client_1.Client; } });
|
|
22
|
-
Object.defineProperty(exports, "createClient", { enumerable: true, get: function () { return zation_client_1.create; } });
|
|
22
|
+
exports.fail = exports.assert = exports.when = void 0;
|
|
23
23
|
const when_1 = require("./lib/api/when");
|
|
24
24
|
Object.defineProperty(exports, "when", { enumerable: true, get: function () { return when_1.when; } });
|
|
25
25
|
const testHelper_1 = require("./lib/api/testHelper");
|
|
26
|
-
Object.defineProperty(exports, "before", { enumerable: true, get: function () { return testHelper_1.beforeTest; } });
|
|
27
|
-
Object.defineProperty(exports, "after", { enumerable: true, get: function () { return testHelper_1.afterTest; } });
|
|
28
|
-
Object.defineProperty(exports, "afterEach", { enumerable: true, get: function () { return testHelper_1.afterEachTest; } });
|
|
29
|
-
Object.defineProperty(exports, "beforeEach", { enumerable: true, get: function () { return testHelper_1.beforeEachTest; } });
|
|
30
|
-
Object.defineProperty(exports, "describe", { enumerable: true, get: function () { return testHelper_1.describeTest; } });
|
|
31
|
-
Object.defineProperty(exports, "it", { enumerable: true, get: function () { return testHelper_1.itTest; } });
|
|
32
26
|
Object.defineProperty(exports, "fail", { enumerable: true, get: function () { return testHelper_1.failTest; } });
|
|
33
27
|
const assert_1 = require("./lib/api/assert");
|
|
34
28
|
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return assert_1.assert; } });
|
package/dist/lib/api/assert.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { StandaloneClientAsserter } from "../helper/asserter/client/standaloneClientAsserter";
|
|
2
|
-
import { Channel, Databox, Client } from "zation-client";
|
|
3
|
-
import {
|
|
2
|
+
import { Channel, Databox, Client, Response } from "zation-client";
|
|
3
|
+
import { Query } from "queric";
|
|
4
4
|
import { StandaloneDataboxAsserter } from "../helper/asserter/databox/standaloneDataboxAsserter";
|
|
5
5
|
import { StandaloneChannelAsserter } from "../helper/asserter/channel/standaloneChannelAsserter";
|
|
6
6
|
import { StandaloneValueAsserter } from "../helper/asserter/value/standaloneValueAsserter";
|
|
7
|
+
import StandaloneResponseAsserter from "../helper/asserter/controller/standaloneResponseAsserter";
|
|
7
8
|
export declare const assert: {
|
|
8
9
|
/**
|
|
9
10
|
* Asserts that the value is true.
|
|
@@ -14,44 +15,50 @@ export declare const assert: {
|
|
|
14
15
|
/**
|
|
15
16
|
* Start value assertions.
|
|
16
17
|
* @param client
|
|
17
|
-
* @param
|
|
18
|
+
* @param description
|
|
18
19
|
*/
|
|
19
|
-
value: (value:
|
|
20
|
+
value: <V>(value: V, description?: string) => StandaloneValueAsserter<V>;
|
|
21
|
+
/**
|
|
22
|
+
* Start response assertions.
|
|
23
|
+
* @param response
|
|
24
|
+
* @param description
|
|
25
|
+
*/
|
|
26
|
+
response: <R extends Response<any>>(response: R | R[], description?: string) => StandaloneResponseAsserter<R>;
|
|
20
27
|
/**
|
|
21
28
|
* Start client assertions.
|
|
22
29
|
* Notice that this method will not automatically connect the clients.
|
|
23
30
|
* @param client
|
|
24
|
-
* @param
|
|
31
|
+
* @param description
|
|
25
32
|
*/
|
|
26
|
-
client: (client:
|
|
33
|
+
client: <C extends Client<any, any>>(client: C | C[], description?: string) => StandaloneClientAsserter<C>;
|
|
27
34
|
/**
|
|
28
35
|
* Start databox assertions.
|
|
29
36
|
* Notice that this method will not automatically connect the databoxes.
|
|
30
37
|
* @param databox
|
|
31
|
-
* @param
|
|
38
|
+
* @param description
|
|
32
39
|
*/
|
|
33
|
-
databox: (databox:
|
|
40
|
+
databox: <D extends Databox<any, any, any, any>>(databox: D | D[], description?: string) => StandaloneDataboxAsserter<D>;
|
|
34
41
|
/**
|
|
35
42
|
* Start channel assertions.
|
|
36
43
|
* Notice that this method will not automatically subscribe to the channels.
|
|
37
44
|
* @param channel
|
|
38
|
-
* @param
|
|
45
|
+
* @param description
|
|
39
46
|
*/
|
|
40
|
-
channel: (channel:
|
|
47
|
+
channel: <C extends Channel<any, any>>(channel: C | C[], description?: string) => StandaloneChannelAsserter<C>;
|
|
41
48
|
/**
|
|
42
|
-
* Asserts that the promise rejects an error that matches with the
|
|
49
|
+
* Asserts that the promise rejects an error that matches with the queric query.
|
|
43
50
|
* @param promise
|
|
44
51
|
* @param query
|
|
45
52
|
* @param message
|
|
46
53
|
*/
|
|
47
|
-
rejects: (promise: Promise<any>, query:
|
|
54
|
+
rejects: (promise: Promise<any>, query: Query, message?: string | Error) => Promise<void>;
|
|
48
55
|
/**
|
|
49
|
-
* Asserts that the promise resolves with a result that matches with the
|
|
56
|
+
* Asserts that the promise resolves with a result that matches with the queric query.
|
|
50
57
|
* @param promise
|
|
51
58
|
* @param query
|
|
52
59
|
* @param message
|
|
53
60
|
*/
|
|
54
|
-
resolves: (promise: Promise<any>, query:
|
|
61
|
+
resolves: (promise: Promise<any>, query: Query, message?: string | Error) => Promise<void>;
|
|
55
62
|
/**
|
|
56
63
|
* Lets the test failing.
|
|
57
64
|
* @param message
|
package/dist/lib/api/assert.js
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.assert = void 0;
|
|
9
9
|
const assertFunc = require("assert");
|
|
10
10
|
const standaloneClientAsserter_1 = require("../helper/asserter/client/standaloneClientAsserter");
|
|
11
|
-
const
|
|
11
|
+
const queric_1 = require("queric");
|
|
12
12
|
const standaloneDataboxAsserter_1 = require("../helper/asserter/databox/standaloneDataboxAsserter");
|
|
13
13
|
const standaloneChannelAsserter_1 = require("../helper/asserter/channel/standaloneChannelAsserter");
|
|
14
14
|
const standaloneValueAsserter_1 = require("../helper/asserter/value/standaloneValueAsserter");
|
|
15
|
+
const standaloneResponseAsserter_1 = require("../helper/asserter/controller/standaloneResponseAsserter");
|
|
15
16
|
exports.assert = ((value, message) => {
|
|
16
17
|
assertFunc(value, message);
|
|
17
18
|
});
|
|
18
|
-
exports.assert.value = (value,
|
|
19
|
-
return new standaloneValueAsserter_1.StandaloneValueAsserter(value,
|
|
19
|
+
exports.assert.value = (value, description) => {
|
|
20
|
+
return new standaloneValueAsserter_1.StandaloneValueAsserter(value, description);
|
|
20
21
|
};
|
|
21
|
-
exports.assert.
|
|
22
|
-
return new
|
|
22
|
+
exports.assert.response = (response, description) => {
|
|
23
|
+
return new standaloneResponseAsserter_1.default(response, description);
|
|
23
24
|
};
|
|
24
|
-
exports.assert.
|
|
25
|
-
return new
|
|
25
|
+
exports.assert.client = (client, description) => {
|
|
26
|
+
return new standaloneClientAsserter_1.StandaloneClientAsserter(client, description);
|
|
26
27
|
};
|
|
27
|
-
exports.assert.
|
|
28
|
-
return new
|
|
28
|
+
exports.assert.databox = (databox, description) => {
|
|
29
|
+
return new standaloneDataboxAsserter_1.StandaloneDataboxAsserter(databox, description);
|
|
30
|
+
};
|
|
31
|
+
exports.assert.channel = (channel, description) => {
|
|
32
|
+
return new standaloneChannelAsserter_1.StandaloneChannelAsserter(channel, description);
|
|
29
33
|
};
|
|
30
34
|
exports.assert.rejects = (promise, query, message) => {
|
|
31
35
|
return new Promise(r => {
|
|
@@ -33,7 +37,7 @@ exports.assert.rejects = (promise, query, message) => {
|
|
|
33
37
|
assertFunc.fail(message);
|
|
34
38
|
r();
|
|
35
39
|
}, (err) => {
|
|
36
|
-
exports.assert(
|
|
40
|
+
(0, exports.assert)((0, queric_1.default)(query)(err), message);
|
|
37
41
|
r();
|
|
38
42
|
});
|
|
39
43
|
});
|
|
@@ -41,7 +45,7 @@ exports.assert.rejects = (promise, query, message) => {
|
|
|
41
45
|
exports.assert.resolves = (promise, query, message) => {
|
|
42
46
|
return new Promise(r => {
|
|
43
47
|
promise.then((res) => {
|
|
44
|
-
exports.assert(
|
|
48
|
+
(0, exports.assert)((0, queric_1.default)(query)(res), message);
|
|
45
49
|
r();
|
|
46
50
|
}, () => {
|
|
47
51
|
assertFunc.fail(message);
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
declare type Func = () => Promise<void> | void;
|
|
2
|
-
export declare const beforeTest: (beforeTest: Func, timeout?: number) => void;
|
|
3
|
-
export declare const afterTest: (afterTest: Func, timeout?: number) => void;
|
|
4
|
-
export declare const beforeEachTest: (beforeEachTest: Func, timeout?: number) => void;
|
|
5
|
-
export declare const afterEachTest: (afterEachTest: Func, timeout?: number) => void;
|
|
6
|
-
export declare const describeTest: (title: string, area: Func, timeout?: number) => void;
|
|
7
|
-
export declare const itTest: (title: string, area: Func, timeout?: number) => void;
|
|
8
1
|
export declare const failTest: (msg: string, actual?: any, expected?: any) => void;
|
|
9
|
-
export {};
|
|
@@ -1,93 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
|
-
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
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.failTest =
|
|
18
|
-
const logger_1 = require("../helper/console/logger");
|
|
8
|
+
exports.failTest = void 0;
|
|
19
9
|
const assert = require('assert');
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
before(function () {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
this.timeout(timeout);
|
|
25
|
-
yield beforeTest();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
exports.beforeTest = beforeTest;
|
|
30
|
-
const afterTest = (afterTest, timeout = 10000) => {
|
|
31
|
-
after(function () {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
this.timeout(timeout);
|
|
34
|
-
yield afterTest();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
exports.afterTest = afterTest;
|
|
39
|
-
const beforeEachTest = (beforeEachTest, timeout = 10000) => {
|
|
40
|
-
firstInit();
|
|
41
|
-
beforeEach(function () {
|
|
42
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
-
this.timeout(timeout);
|
|
44
|
-
yield beforeEachTest;
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
exports.beforeEachTest = beforeEachTest;
|
|
49
|
-
const afterEachTest = (afterEachTest, timeout = 10000) => {
|
|
50
|
-
afterEach(function () {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
this.timeout(timeout);
|
|
53
|
-
yield afterEachTest;
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
exports.afterEachTest = afterEachTest;
|
|
58
|
-
const describeTest = (title, area, timeout = 10000) => {
|
|
59
|
-
firstInit();
|
|
60
|
-
describe(title, function () {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
this.timeout(timeout);
|
|
63
|
-
yield area();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
exports.describeTest = describeTest;
|
|
68
|
-
const itTest = (title, area, timeout = 10000) => {
|
|
69
|
-
firstInit();
|
|
70
|
-
it(title, function () {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
-
this.timeout(timeout);
|
|
73
|
-
yield area();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
exports.itTest = itTest;
|
|
78
|
-
const failTest = (msg, actual, expected) => {
|
|
79
|
-
if (actual !== undefined || expected !== undefined) {
|
|
10
|
+
const failTest = function (msg, actual, expected) {
|
|
11
|
+
if (arguments.length > 1)
|
|
80
12
|
assert.fail(actual, expected, msg);
|
|
81
|
-
|
|
82
|
-
else {
|
|
13
|
+
else
|
|
83
14
|
assert.fail(msg);
|
|
84
|
-
}
|
|
85
15
|
};
|
|
86
16
|
exports.failTest = failTest;
|
|
87
|
-
let firstCall = true;
|
|
88
|
-
const firstInit = () => {
|
|
89
|
-
if (firstCall) {
|
|
90
|
-
firstCall = false;
|
|
91
|
-
logger_1.Logger.logBusy('Run Tests');
|
|
92
|
-
}
|
|
93
|
-
};
|
package/dist/lib/api/when.d.ts
CHANGED
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValidationCheckPair, Client, AUTH_CONTROLLER, ChecksContent, Response, FilterAPIDefinition, AnyControllerDef, ReceiverDef } from 'zation-client';
|
|
2
2
|
import { Test } from "../helper/test/test";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { ExtractControllerDefInput, ExtractControllerDefOutput, ExtractAuthControllerDef } from "zation-client";
|
|
4
|
+
import TransmitOptions, { RequestOptions, ValidationRequestOptions } from "../helper/definitions/optionTypes";
|
|
5
|
+
import AssertStarter from "../helper/asserter/assertStarter";
|
|
6
|
+
import { IntegratedResponseAsserter } from "../helper/asserter/controller/integratedResponseAsserter";
|
|
7
|
+
import { IntegratedTransmitAsserter } from "../helper/asserter/receiver/integratedTransmitAsserter";
|
|
8
|
+
import { ClientAPI } from "../helper/utils/types";
|
|
9
|
+
import { SystemController } from "zation-client/dist/lib/main/definitions/systemController";
|
|
10
|
+
export declare class WhenBuilder<C extends Client<any, any>> {
|
|
9
11
|
private readonly _client;
|
|
10
12
|
private readonly _test;
|
|
11
|
-
constructor(client:
|
|
12
|
-
static when(client:
|
|
13
|
+
constructor(client: C, test: Test);
|
|
14
|
+
static when<C extends Client<any, any>>(client: C, it?: string): WhenBuilder<C>;
|
|
13
15
|
/**
|
|
14
16
|
* @description
|
|
15
|
-
*
|
|
16
|
-
* The StandardRequestBuilder can be used to easily build
|
|
17
|
-
* a standard request.
|
|
18
|
-
* The default values are:
|
|
19
|
-
* Data: undefined
|
|
17
|
+
* Creates a request test action.
|
|
20
18
|
* @example
|
|
21
|
-
* when(client1)
|
|
22
|
-
*
|
|
23
|
-
*
|
|
19
|
+
* when(client1)
|
|
20
|
+
* .request('sendMessage',message)
|
|
21
|
+
* .assertThat....
|
|
24
22
|
* @param controller
|
|
25
23
|
* @param data
|
|
24
|
+
* @param options
|
|
26
25
|
*/
|
|
27
|
-
request(controller:
|
|
26
|
+
request<CN extends keyof FilterAPIDefinition<ClientAPI<C>, AnyControllerDef> | typeof AUTH_CONTROLLER | SystemController>(controller: CN, data?: CN extends typeof AUTH_CONTROLLER ? ExtractControllerDefInput<ExtractAuthControllerDef<ClientAPI<C>>> : ExtractControllerDefInput<FilterAPIDefinition<ClientAPI<C>, CN>>, options?: RequestOptions): AssertStarter<IntegratedResponseAsserter<Response<ExtractControllerDefOutput<FilterAPIDefinition<ClientAPI<C>, CN>>>, C>>;
|
|
28
27
|
/**
|
|
29
28
|
* @description
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* The
|
|
34
|
-
*
|
|
29
|
+
* Creates a request validation test action.
|
|
30
|
+
* This action sends a validation request to a specific controller.
|
|
31
|
+
* Validation requests only validate the given checks with the controller input models.
|
|
32
|
+
* The controller handle method will not be invoked.
|
|
33
|
+
* It is helpful to check form inputs directly even if the user
|
|
34
|
+
* has not filled out the complete data.
|
|
35
35
|
* @example
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* a validation check request.
|
|
47
|
-
* The default values are:
|
|
48
|
-
* Checks: []
|
|
49
|
-
* @example
|
|
50
|
-
* when(client1).validationRequest('sendMessage')
|
|
51
|
-
* .check('msg','hallo')
|
|
52
|
-
* ....
|
|
36
|
+
* //Check builder usage (typesafe):
|
|
37
|
+
* when(client1)
|
|
38
|
+
* .requestValidation('sendMessage',s => {
|
|
39
|
+
* s.msg.check("Hello!");
|
|
40
|
+
* })
|
|
41
|
+
* .assertThat....
|
|
42
|
+
* //Raw usage (not typesafe):
|
|
43
|
+
* when(client1)
|
|
44
|
+
* .requestValidation('sendMessage',[[['msg'],'Hello!']]);
|
|
45
|
+
* .assertThat....
|
|
53
46
|
* @param controller
|
|
54
47
|
* @param checks
|
|
48
|
+
* @param options
|
|
55
49
|
*/
|
|
56
|
-
|
|
50
|
+
requestValidation<CN extends keyof FilterAPIDefinition<ClientAPI<C>, AnyControllerDef> | typeof AUTH_CONTROLLER>(controller: CN, checks: ValidationCheckPair[] | ((structure: ChecksContent<CN extends typeof AUTH_CONTROLLER ? ExtractControllerDefInput<ExtractAuthControllerDef<ClientAPI<C>>> : ExtractControllerDefInput<FilterAPIDefinition<ClientAPI<C>, CN>>>) => void), options?: ValidationRequestOptions): AssertStarter<IntegratedResponseAsserter<Response<void>, C>>;
|
|
57
51
|
/**
|
|
58
52
|
* @description
|
|
59
|
-
*
|
|
60
|
-
* The PackageBuilder can be used to easily build a package send it to a receiver.
|
|
53
|
+
* Creates a transmit test action.
|
|
61
54
|
* @example
|
|
62
|
-
* when(client1)
|
|
55
|
+
* when(client1)
|
|
56
|
+
* .transmit('updatePosition',[1,2,2])
|
|
57
|
+
* .assertThat....
|
|
63
58
|
* @param receiver
|
|
64
59
|
* @param data
|
|
60
|
+
* @param options
|
|
65
61
|
*/
|
|
66
|
-
transmit(receiver:
|
|
62
|
+
transmit<RN extends keyof FilterAPIDefinition<ClientAPI<C>, ReceiverDef>>(receiver: RN, data?: ClientAPI<C>['receivers'][RN], options?: TransmitOptions): AssertStarter<IntegratedTransmitAsserter<C>>;
|
|
67
63
|
}
|
|
64
|
+
export declare const when: typeof WhenBuilder.when;
|
package/dist/lib/api/when.js
CHANGED
|
@@ -1,93 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Author: Luca Scaringella
|
|
3
|
+
Author: Ing. Luca Gian Scaringella
|
|
4
4
|
GitHub: LucaCode
|
|
5
|
-
|
|
5
|
+
Copyright(c) Ing. Luca Gian Scaringella
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
8
|
+
exports.when = exports.WhenBuilder = void 0;
|
|
9
9
|
const test_1 = require("../helper/test/test");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const packageBuilder_1 = require("../helper/builder/receiver/packageBuilder");
|
|
14
|
-
const when = (client, itTestDescription) => {
|
|
15
|
-
return WhenBuilder.when(client, itTestDescription);
|
|
16
|
-
};
|
|
17
|
-
exports.when = when;
|
|
10
|
+
const assertStarter_1 = require("../helper/asserter/assertStarter");
|
|
11
|
+
const integratedResponseAsserter_1 = require("../helper/asserter/controller/integratedResponseAsserter");
|
|
12
|
+
const integratedTransmitAsserter_1 = require("../helper/asserter/receiver/integratedTransmitAsserter");
|
|
18
13
|
class WhenBuilder {
|
|
19
14
|
constructor(client, test) {
|
|
20
15
|
this._client = client;
|
|
21
16
|
this._test = test;
|
|
22
17
|
}
|
|
23
|
-
static when(client,
|
|
24
|
-
return new WhenBuilder(client, new test_1.Test(
|
|
18
|
+
static when(client, it) {
|
|
19
|
+
return new WhenBuilder(client, new test_1.Test(it));
|
|
25
20
|
}
|
|
26
21
|
// noinspection JSUnusedGlobalSymbols
|
|
27
22
|
/**
|
|
28
23
|
* @description
|
|
29
|
-
*
|
|
30
|
-
* The StandardRequestBuilder can be used to easily build
|
|
31
|
-
* a standard request.
|
|
32
|
-
* The default values are:
|
|
33
|
-
* Data: undefined
|
|
24
|
+
* Creates a request test action.
|
|
34
25
|
* @example
|
|
35
|
-
* when(client1)
|
|
36
|
-
*
|
|
37
|
-
*
|
|
26
|
+
* when(client1)
|
|
27
|
+
* .request('sendMessage',message)
|
|
28
|
+
* .assertThat....
|
|
38
29
|
* @param controller
|
|
39
30
|
* @param data
|
|
31
|
+
* @param options
|
|
40
32
|
*/
|
|
41
|
-
request(controller, data) {
|
|
42
|
-
return new
|
|
33
|
+
request(controller, data, options = {}) {
|
|
34
|
+
return new assertStarter_1.default(new integratedResponseAsserter_1.IntegratedResponseAsserter(() => this._client.request(controller, data, Object.assign(Object.assign({}, options), { unwrapResult: false })), this._test, this._client));
|
|
43
35
|
}
|
|
44
36
|
// noinspection JSUnusedGlobalSymbols
|
|
45
37
|
/**
|
|
46
38
|
* @description
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* The
|
|
51
|
-
*
|
|
39
|
+
* Creates a request validation test action.
|
|
40
|
+
* This action sends a validation request to a specific controller.
|
|
41
|
+
* Validation requests only validate the given checks with the controller input models.
|
|
42
|
+
* The controller handle method will not be invoked.
|
|
43
|
+
* It is helpful to check form inputs directly even if the user
|
|
44
|
+
* has not filled out the complete data.
|
|
52
45
|
* @example
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* @description
|
|
64
|
-
* Returns an ValidationCheckRequestBuilder.
|
|
65
|
-
* The ValidationCheckRequestBuilder can be used to easily build
|
|
66
|
-
* a validation check request.
|
|
67
|
-
* The default values are:
|
|
68
|
-
* Checks: []
|
|
69
|
-
* @example
|
|
70
|
-
* when(client1).validationRequest('sendMessage')
|
|
71
|
-
* .check('msg','hallo')
|
|
72
|
-
* ....
|
|
46
|
+
* //Check builder usage (typesafe):
|
|
47
|
+
* when(client1)
|
|
48
|
+
* .requestValidation('sendMessage',s => {
|
|
49
|
+
* s.msg.check("Hello!");
|
|
50
|
+
* })
|
|
51
|
+
* .assertThat....
|
|
52
|
+
* //Raw usage (not typesafe):
|
|
53
|
+
* when(client1)
|
|
54
|
+
* .requestValidation('sendMessage',[[['msg'],'Hello!']]);
|
|
55
|
+
* .assertThat....
|
|
73
56
|
* @param controller
|
|
74
57
|
* @param checks
|
|
58
|
+
* @param options
|
|
75
59
|
*/
|
|
76
|
-
|
|
77
|
-
return new
|
|
60
|
+
requestValidation(controller, checks, options = {}) {
|
|
61
|
+
return new assertStarter_1.default(new integratedResponseAsserter_1.IntegratedResponseAsserter(() => this._client.requestValidation(controller, checks, options), this._test, this._client));
|
|
78
62
|
}
|
|
79
63
|
// noinspection JSUnusedGlobalSymbols
|
|
80
64
|
/**
|
|
81
65
|
* @description
|
|
82
|
-
*
|
|
83
|
-
* The PackageBuilder can be used to easily build a package send it to a receiver.
|
|
66
|
+
* Creates a transmit test action.
|
|
84
67
|
* @example
|
|
85
|
-
* when(client1)
|
|
68
|
+
* when(client1)
|
|
69
|
+
* .transmit('updatePosition',[1,2,2])
|
|
70
|
+
* .assertThat....
|
|
86
71
|
* @param receiver
|
|
87
72
|
* @param data
|
|
73
|
+
* @param options
|
|
88
74
|
*/
|
|
89
|
-
transmit(receiver, data) {
|
|
90
|
-
return new
|
|
75
|
+
transmit(receiver, data, options = {}) {
|
|
76
|
+
return new assertStarter_1.default(new integratedTransmitAsserter_1.IntegratedTransmitAsserter(() => this._client.transmit(receiver, data, options), this._test, this._client));
|
|
91
77
|
}
|
|
92
78
|
}
|
|
93
79
|
exports.WhenBuilder = WhenBuilder;
|
|
80
|
+
exports.when = WhenBuilder.when;
|