zation-assured 0.6.0 → 3.0.0-dev.2

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.
Files changed (151) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +55 -2
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +3 -9
  5. package/dist/lib/api/assert.d.ts +21 -14
  6. package/dist/lib/api/assert.js +17 -13
  7. package/dist/lib/api/testHelper.d.ts +0 -8
  8. package/dist/lib/api/testHelper.js +6 -83
  9. package/dist/lib/api/when.d.ts +41 -45
  10. package/dist/lib/api/when.js +42 -55
  11. package/dist/lib/helper/asserter/abstractActionAsserter.d.ts +68 -0
  12. package/dist/lib/helper/asserter/{rootSendAsserter.js → abstractActionAsserter.js} +23 -67
  13. package/dist/lib/helper/asserter/assertStarter.d.ts +5 -0
  14. package/dist/lib/helper/asserter/assertStarter.js +16 -0
  15. package/dist/lib/helper/asserter/channel/abstractChannelAsserter.d.ts +20 -29
  16. package/dist/lib/helper/asserter/channel/abstractChannelAsserter.js +44 -85
  17. package/dist/lib/helper/asserter/channel/channelAsserter.d.ts +3 -3
  18. package/dist/lib/helper/asserter/channel/channelAsserter.js +2 -2
  19. package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.d.ts +5 -5
  20. package/dist/lib/helper/asserter/channel/standaloneChannelAsserter.js +6 -6
  21. package/dist/lib/helper/asserter/client/abstractClientAsserter.d.ts +20 -38
  22. package/dist/lib/helper/asserter/client/abstractClientAsserter.js +82 -184
  23. package/dist/lib/helper/asserter/client/clientAsserter.d.ts +3 -3
  24. package/dist/lib/helper/asserter/client/clientAsserter.js +2 -2
  25. package/dist/lib/helper/asserter/client/standaloneClientAsserter.d.ts +5 -5
  26. package/dist/lib/helper/asserter/client/standaloneClientAsserter.js +6 -6
  27. package/dist/lib/helper/asserter/controller/integratedResponseAsserter.d.ts +52 -0
  28. package/dist/lib/helper/asserter/controller/integratedResponseAsserter.js +112 -0
  29. package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.d.ts +49 -0
  30. package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.js +108 -0
  31. package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.d.ts +29 -36
  32. package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.js +44 -80
  33. package/dist/lib/helper/asserter/databox/databoxAsserter.d.ts +3 -3
  34. package/dist/lib/helper/asserter/databox/databoxAsserter.js +2 -2
  35. package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.d.ts +6 -5
  36. package/dist/lib/helper/asserter/databox/standaloneDataboxAsserter.js +6 -6
  37. package/dist/lib/helper/asserter/event/abstractEventAsserter.d.ts +12 -4
  38. package/dist/lib/helper/asserter/event/abstractEventAsserter.js +25 -10
  39. package/dist/lib/helper/asserter/event/codeMetadataEventAsserter.d.ts +21 -0
  40. package/dist/lib/helper/asserter/event/codeMetadataEventAsserter.js +47 -0
  41. package/dist/lib/helper/asserter/event/dataEventAsserter.d.ts +13 -3
  42. package/dist/lib/helper/asserter/event/dataEventAsserter.js +22 -4
  43. package/dist/lib/helper/asserter/receiver/integratedTransmitAsserter.d.ts +9 -0
  44. package/dist/lib/helper/asserter/receiver/{transmitAsserter.js → integratedTransmitAsserter.js} +9 -9
  45. package/dist/lib/helper/asserter/value/abstractValueAsserter.d.ts +13 -15
  46. package/dist/lib/helper/asserter/value/abstractValueAsserter.js +49 -53
  47. package/dist/lib/helper/asserter/value/standaloneValueAsserter.d.ts +3 -3
  48. package/dist/lib/helper/asserter/value/standaloneValueAsserter.js +6 -6
  49. package/dist/lib/helper/asserter/value/valueAsserter.d.ts +4 -4
  50. package/dist/lib/helper/asserter/value/valueAsserter.js +4 -4
  51. package/dist/lib/helper/backError/backErrorsFilterBuilder.d.ts +12 -0
  52. package/dist/lib/helper/backError/backErrorsFilterBuilder.js +29 -0
  53. package/dist/lib/helper/console/logger.js +2 -2
  54. package/dist/lib/helper/definitions/optionTypes.d.ts +8 -0
  55. package/dist/lib/helper/definitions/optionTypes.js +7 -0
  56. package/dist/lib/helper/test/test.d.ts +2 -2
  57. package/dist/lib/helper/test/test.js +8 -6
  58. package/dist/lib/helper/timeout/timeoutAssert.js +2 -2
  59. package/dist/lib/helper/utils/actionUtils.d.ts +5 -18
  60. package/dist/lib/helper/utils/actionUtils.js +14 -43
  61. package/dist/lib/helper/utils/types.d.ts +20 -0
  62. package/dist/lib/helper/utils/types.js +7 -0
  63. package/package.json +8 -10
  64. package/dist/lib/api/before.d.ts +0 -3
  65. package/dist/lib/api/before.js +0 -20
  66. package/dist/lib/api/client.d.ts +0 -3
  67. package/dist/lib/api/client.js +0 -11
  68. package/dist/lib/api/describe.d.ts +0 -1
  69. package/dist/lib/api/describe.js +0 -6
  70. package/dist/lib/api/instanceManager.d.ts +0 -8
  71. package/dist/lib/api/instanceManager.js +0 -48
  72. package/dist/lib/api/testArea.d.ts +0 -3
  73. package/dist/lib/api/testArea.js +0 -41
  74. package/dist/lib/api/testServerManager.d.ts +0 -19
  75. package/dist/lib/api/testServerManager.js +0 -100
  76. package/dist/lib/helper/asserter/abstractClientAsserter.d.ts +0 -102
  77. package/dist/lib/helper/asserter/abstractClientAsserter.js +0 -293
  78. package/dist/lib/helper/asserter/anyAsserter.d.ts +0 -62
  79. package/dist/lib/helper/asserter/anyAsserter.js +0 -130
  80. package/dist/lib/helper/asserter/channelEventAsserter.d.ts +0 -34
  81. package/dist/lib/helper/asserter/channelEventAsserter.js +0 -84
  82. package/dist/lib/helper/asserter/channelPubAsserter.d.ts +0 -53
  83. package/dist/lib/helper/asserter/channelPubAsserter.js +0 -126
  84. package/dist/lib/helper/asserter/clientAsserter.d.ts +0 -13
  85. package/dist/lib/helper/asserter/clientAsserter.js +0 -26
  86. package/dist/lib/helper/asserter/controller/responseAsserter.d.ts +0 -74
  87. package/dist/lib/helper/asserter/controller/responseAsserter.js +0 -138
  88. package/dist/lib/helper/asserter/dataEventAsserter.d.ts +0 -40
  89. package/dist/lib/helper/asserter/dataEventAsserter.js +0 -113
  90. package/dist/lib/helper/asserter/event/abstractDataEventAsserter.d.ts +0 -13
  91. package/dist/lib/helper/asserter/event/abstractDataEventAsserter.js +0 -36
  92. package/dist/lib/helper/asserter/event/codeDataEventAsserter.d.ts +0 -14
  93. package/dist/lib/helper/asserter/event/codeDataEventAsserter.js +0 -40
  94. package/dist/lib/helper/asserter/eventAsserter.d.ts +0 -41
  95. package/dist/lib/helper/asserter/eventAsserter.js +0 -115
  96. package/dist/lib/helper/asserter/objectAsserter.d.ts +0 -55
  97. package/dist/lib/helper/asserter/objectAsserter.js +0 -113
  98. package/dist/lib/helper/asserter/receiver/transmitAsserter.d.ts +0 -9
  99. package/dist/lib/helper/asserter/responseAsserter.d.ts +0 -129
  100. package/dist/lib/helper/asserter/responseAsserter.js +0 -260
  101. package/dist/lib/helper/asserter/rootSendAsserter.d.ts +0 -89
  102. package/dist/lib/helper/asserter/standaloneClientAsserter.d.ts +0 -11
  103. package/dist/lib/helper/asserter/standaloneClientAsserter.js +0 -38
  104. package/dist/lib/helper/assured/clientAssured.d.ts +0 -2
  105. package/dist/lib/helper/assured/clientAssured.js +0 -11
  106. package/dist/lib/helper/assured/responseAssured.d.ts +0 -17
  107. package/dist/lib/helper/assured/responseAssured.js +0 -72
  108. package/dist/lib/helper/backError/backErrorFilterBuilder.d.ts +0 -13
  109. package/dist/lib/helper/backError/backErrorFilterBuilder.js +0 -32
  110. package/dist/lib/helper/builder/controller/abstractRequestBuilder.d.ts +0 -53
  111. package/dist/lib/helper/builder/controller/abstractRequestBuilder.js +0 -69
  112. package/dist/lib/helper/builder/controller/authRequestBuilder.d.ts +0 -15
  113. package/dist/lib/helper/builder/controller/authRequestBuilder.js +0 -30
  114. package/dist/lib/helper/builder/controller/standardRequestBuilder.d.ts +0 -15
  115. package/dist/lib/helper/builder/controller/standardRequestBuilder.js +0 -30
  116. package/dist/lib/helper/builder/controller/validationCheckRequestBuilder.d.ts +0 -21
  117. package/dist/lib/helper/builder/controller/validationCheckRequestBuilder.js +0 -40
  118. package/dist/lib/helper/builder/receiver/packageBuilder.d.ts +0 -45
  119. package/dist/lib/helper/builder/receiver/packageBuilder.js +0 -67
  120. package/dist/lib/helper/controller/request/abstractRequestBuilder.d.ts +0 -53
  121. package/dist/lib/helper/controller/request/abstractRequestBuilder.js +0 -68
  122. package/dist/lib/helper/controller/request/authRequestBuilder.d.ts +0 -15
  123. package/dist/lib/helper/controller/request/authRequestBuilder.js +0 -29
  124. package/dist/lib/helper/controller/request/standardRequestBuilder.d.ts +0 -15
  125. package/dist/lib/helper/controller/request/standardRequestBuilder.js +0 -29
  126. package/dist/lib/helper/controller/request/validationCheckRequestBuilder.d.ts +0 -21
  127. package/dist/lib/helper/controller/request/validationCheckRequestBuilder.js +0 -39
  128. package/dist/lib/helper/data/test.d.ts +0 -13
  129. package/dist/lib/helper/data/test.js +0 -89
  130. package/dist/lib/helper/do/actionUtils.d.ts +0 -24
  131. package/dist/lib/helper/do/actionUtils.js +0 -70
  132. package/dist/lib/helper/do/doUtils.d.ts +0 -24
  133. package/dist/lib/helper/do/doUtils.js +0 -80
  134. package/dist/lib/helper/error/backErrorFilterBuilder.d.ts +0 -13
  135. package/dist/lib/helper/error/backErrorFilterBuilder.js +0 -34
  136. package/dist/lib/helper/error/taskErrorFilterBuilder.d.ts +0 -13
  137. package/dist/lib/helper/error/taskErrorFilterBuilder.js +0 -34
  138. package/dist/lib/helper/request/abstractRequestBuilder.d.ts +0 -53
  139. package/dist/lib/helper/request/abstractRequestBuilder.js +0 -68
  140. package/dist/lib/helper/request/authRequestBuilder.d.ts +0 -15
  141. package/dist/lib/helper/request/authRequestBuilder.js +0 -29
  142. package/dist/lib/helper/request/requestBuilder.d.ts +0 -46
  143. package/dist/lib/helper/request/requestBuilder.js +0 -76
  144. package/dist/lib/helper/request/standardRequestBuilder.d.ts +0 -15
  145. package/dist/lib/helper/request/standardRequestBuilder.js +0 -29
  146. package/dist/lib/helper/request/validationCheckRequestBuilder.d.ts +0 -21
  147. package/dist/lib/helper/request/validationCheckRequestBuilder.js +0 -39
  148. package/dist/lib/helper/request/validationRequestBuilder.d.ts +0 -35
  149. package/dist/lib/helper/request/validationRequestBuilder.js +0 -61
  150. package/dist/lib/helper/utils/clientUtils.d.ts +0 -4
  151. package/dist/lib/helper/utils/clientUtils.js +0 -29
@@ -1,67 +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.PackageBuilder = void 0;
9
- const transmitAsserter_1 = require("../../asserter/receiver/transmitAsserter");
10
- class PackageBuilder {
11
- constructor(nativeBuilder, test, client) {
12
- this.test = test;
13
- this.client = client;
14
- this.natveBuilder = nativeBuilder;
15
- }
16
- // noinspection JSUnusedGlobalSymbols
17
- /**
18
- * @description
19
- * Sets the data of the package.
20
- * @param data
21
- * @default undefined
22
- */
23
- data(data) {
24
- this.natveBuilder.data(data);
25
- return this;
26
- }
27
- // noinspection JSUnusedGlobalSymbols
28
- /**
29
- * @description
30
- * Set the apiLevel of the package.
31
- * @param apiLevel.
32
- * @default undefined.
33
- */
34
- apiLevel(apiLevel) {
35
- this.natveBuilder.apiLevel(apiLevel);
36
- return this;
37
- }
38
- // noinspection JSUnusedGlobalSymbols
39
- /**
40
- * With the ConnectTimeout option, you can activate that the socket is
41
- * trying to connect when it is not connected. You have five possible choices:
42
- * Undefined: It will use the value from the default options.
43
- * False: The action will fail and throw a ConnectionRequiredError,
44
- * when the socket is not connected.
45
- * Null: The socket will try to connect (if it is not connected) and
46
- * waits until the connection is made, then it continues the action.
47
- * Number: Same as null, but now you can specify a timeout (in ms) of
48
- * maximum waiting time for the connection. If the timeout is reached,
49
- * it will throw a timeout error.
50
- * AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
51
- * @param timeout
52
- * @default undefined
53
- */
54
- connectTimeout(timeout) {
55
- this.natveBuilder.connectTimeout(timeout);
56
- return this;
57
- }
58
- // noinspection JSUnusedGlobalSymbols
59
- /**
60
- * @description
61
- * Start the assertions.
62
- */
63
- assertThat() {
64
- return new transmitAsserter_1.TransmitAsserter(this.natveBuilder, this.test, this.client);
65
- }
66
- }
67
- exports.PackageBuilder = PackageBuilder;
@@ -1,53 +0,0 @@
1
- import { AbstractRequestBuilder as NativeAbstractRequestBuilder, ZationClient } from "zation-client";
2
- import { Test } from "../../test/test";
3
- import { ResponseAsserter } from "../../asserter/responseAsserter";
4
- import { ConnectTimeoutOption } from "zation-client/dist/lib/main/utils/connectionUtils";
5
- export declare abstract class AbstractRequestBuilder<T, RT> {
6
- private readonly test;
7
- private readonly client;
8
- private readonly abReq;
9
- protected constructor(test: Test, client: ZationClient, req: NativeAbstractRequestBuilder<any>);
10
- /**
11
- * @description
12
- * Set the apiLevel of the request.
13
- * @param apiLevel.
14
- * @default undefined.
15
- */
16
- apiLevel(apiLevel: number | undefined): T;
17
- /**
18
- * @description
19
- * Set the timeout for the response of the request.
20
- * Value can be null which means the timeout is disabled or
21
- * undefined then it will use the default timeout of the zation config,
22
- * or it can be a number that indicates the milliseconds.
23
- * @param timeout
24
- */
25
- responseTimeout(timeout: null | undefined | number): T;
26
- /**
27
- * With the ConnectTimeout option, you can activate that the socket is
28
- * trying to connect when it is not connected. You have five possible choices:
29
- * Undefined: It will use the value from the default options.
30
- * False: The action will fail and throw a ConnectionRequiredError,
31
- * when the socket is not connected.
32
- * Null: The socket will try to connect (if it is not connected) and
33
- * waits until the connection is made, then it continues the action.
34
- * Number: Same as null, but now you can specify a timeout (in ms) of
35
- * maximum waiting time for the connection. If the timeout is reached,
36
- * it will throw a timeout error.
37
- * AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
38
- * @param timeout
39
- * @default undefined
40
- */
41
- connectTimeout(timeout: ConnectTimeoutOption): T;
42
- /**
43
- * @description
44
- * Start the 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,68 +0,0 @@
1
- "use strict";
2
- /*
3
- Author: Luca Scaringella
4
- GitHub: LucaCode
5
- ©Copyright by Luca Scaringella
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const responseAsserter_1 = require("../../asserter/responseAsserter");
9
- class AbstractRequestBuilder {
10
- constructor(test, client, req) {
11
- this.test = test;
12
- this.client = client;
13
- this.abReq = req;
14
- }
15
- // noinspection JSUnusedGlobalSymbols
16
- /**
17
- * @description
18
- * Set the apiLevel of the request.
19
- * @param apiLevel.
20
- * @default undefined.
21
- */
22
- apiLevel(apiLevel) {
23
- this.abReq.apiLevel(apiLevel);
24
- return this.self();
25
- }
26
- // noinspection JSUnusedGlobalSymbols
27
- /**
28
- * @description
29
- * Set the timeout for the response of the request.
30
- * Value can be null which means the timeout is disabled or
31
- * undefined then it will use the default timeout of the zation config,
32
- * or it can be a number that indicates the milliseconds.
33
- * @param timeout
34
- */
35
- responseTimeout(timeout) {
36
- this.abReq.responseTimeout(timeout);
37
- return this.self();
38
- }
39
- // noinspection JSUnusedGlobalSymbols
40
- /**
41
- * With the ConnectTimeout option, you can activate that the socket is
42
- * trying to connect when it is not connected. You have five possible choices:
43
- * Undefined: It will use the value from the default options.
44
- * False: The action will fail and throw a ConnectionRequiredError,
45
- * when the socket is not connected.
46
- * Null: The socket will try to connect (if it is not connected) and
47
- * waits until the connection is made, then it continues the action.
48
- * Number: Same as null, but now you can specify a timeout (in ms) of
49
- * maximum waiting time for the connection. If the timeout is reached,
50
- * it will throw a timeout error.
51
- * AbortTrigger: Same as null, but now you have the possibility to abort the wait later.
52
- * @param timeout
53
- * @default undefined
54
- */
55
- connectTimeout(timeout) {
56
- this.abReq.connectTimeout(timeout);
57
- return this.self();
58
- }
59
- // noinspection JSUnusedGlobalSymbols
60
- /**
61
- * @description
62
- * Start the assertions.
63
- */
64
- assertThat() {
65
- return new responseAsserter_1.ResponseAsserter(this.abReq, this.test, this.client);
66
- }
67
- }
68
- exports.AbstractRequestBuilder = AbstractRequestBuilder;
@@ -1,15 +0,0 @@
1
- import { AbstractRequestBuilder } from "./abstractRequestBuilder";
2
- import { AuthRequestBuilder as NativeAuthRequestBuilder, ZationClient } 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: ZationClient);
7
- /**
8
- * @description
9
- * Set the authData of the request.
10
- * @param data
11
- * @default undefined (equals to {} on server param based input).
12
- */
13
- authData(data: any): AuthRequestBuilder;
14
- protected self(): AuthRequestBuilder;
15
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- /*
3
- Author: Luca Scaringella
4
- GitHub: LucaCode
5
- ©Copyright by Luca Scaringella
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
9
- class AuthRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
10
- constructor(req, test, client) {
11
- super(test, client, req);
12
- this.req = req;
13
- }
14
- // noinspection JSUnusedGlobalSymbols
15
- /**
16
- * @description
17
- * Set the authData of the request.
18
- * @param data
19
- * @default undefined (equals to {} on server param based input).
20
- */
21
- authData(data) {
22
- this.req.authData(data);
23
- return this;
24
- }
25
- self() {
26
- return this;
27
- }
28
- }
29
- exports.AuthRequestBuilder = AuthRequestBuilder;
@@ -1,15 +0,0 @@
1
- import { StandardRequestBuilder as NativeStandardRequestBuilder, ZationClient } 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: ZationClient);
7
- /**
8
- * @description
9
- * Set the data of the request.
10
- * @param data
11
- * @default undefined (equals to {} on server param based input).
12
- */
13
- data(data: any): StandardRequestBuilder;
14
- protected self(): StandardRequestBuilder;
15
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- /*
3
- Author: Luca Scaringella
4
- GitHub: LucaCode
5
- ©Copyright by Luca Scaringella
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
9
- class StandardRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
10
- constructor(req, test, client) {
11
- super(test, client, req);
12
- this.req = req;
13
- }
14
- // noinspection JSUnusedGlobalSymbols
15
- /**
16
- * @description
17
- * Set the data of the request.
18
- * @param data
19
- * @default undefined (equals to {} on server param based input).
20
- */
21
- data(data) {
22
- this.req.data(data);
23
- return this;
24
- }
25
- self() {
26
- return this;
27
- }
28
- }
29
- exports.StandardRequestBuilder = StandardRequestBuilder;
@@ -1,21 +0,0 @@
1
- import { AbstractRequestBuilder } from "./abstractRequestBuilder";
2
- import { ValidationCheckPair, ValidationCheckRequestBuilder as NativeValidationCheckRequestBuilder, ZationClient } 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: ZationClient);
7
- /**
8
- * @description
9
- * Adds validation checks.
10
- * @param checks
11
- */
12
- checks(...checks: ValidationCheckPair[]): ValidationCheckRequestBuilder;
13
- /**
14
- * @description
15
- * Adds validation check.
16
- * @param path
17
- * @param value
18
- */
19
- check(path: string | string[], value: any): ValidationCheckRequestBuilder;
20
- protected self(): ValidationCheckRequestBuilder;
21
- }
@@ -1,39 +0,0 @@
1
- "use strict";
2
- /*
3
- Author: Luca Scaringella
4
- GitHub: LucaCode
5
- ©Copyright by Luca Scaringella
6
- */
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const abstractRequestBuilder_1 = require("./abstractRequestBuilder");
9
- class ValidationCheckRequestBuilder extends abstractRequestBuilder_1.AbstractRequestBuilder {
10
- constructor(req, test, client) {
11
- super(test, client, req);
12
- this.req = req;
13
- }
14
- // noinspection JSUnusedGlobalSymbols
15
- /**
16
- * @description
17
- * Adds validation checks.
18
- * @param checks
19
- */
20
- checks(...checks) {
21
- this.req.checks(...checks);
22
- return this;
23
- }
24
- // noinspection JSUnusedGlobalSymbols
25
- /**
26
- * @description
27
- * Adds validation check.
28
- * @param path
29
- * @param value
30
- */
31
- check(path, value) {
32
- this.req.check(path, value);
33
- return this;
34
- }
35
- self() {
36
- return this;
37
- }
38
- }
39
- exports.ValidationCheckRequestBuilder = ValidationCheckRequestBuilder;
@@ -1,13 +0,0 @@
1
- declare type Action = () => Promise<void> | void;
2
- export declare class Test {
3
- private readonly _subTests;
4
- private currentSubTest;
5
- private readonly _testDescription;
6
- constructor(testDescription: string);
7
- newSubTest(): void;
8
- beforeTest(action: Action, waitForTask?: boolean): void;
9
- test(action: Action, waitForTask?: boolean): void;
10
- afterTest(action: Action, waitForTask?: boolean): void;
11
- execute(): void;
12
- }
13
- export {};
@@ -1,89 +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
- class Test {
18
- constructor(testDescription) {
19
- this._subTests = [];
20
- this._testDescription = testDescription;
21
- this.newSubTest();
22
- }
23
- newSubTest() {
24
- const subTest = new SubTest();
25
- this.currentSubTest = subTest;
26
- this._subTests.push(subTest);
27
- }
28
- beforeTest(action, waitForTask = false) {
29
- this.currentSubTest.beforeTest(action, waitForTask);
30
- }
31
- test(action, waitForTask = false) {
32
- this.currentSubTest.test(action, waitForTask);
33
- }
34
- // noinspection JSUnusedGlobalSymbols
35
- afterTest(action, waitForTask = false) {
36
- this.currentSubTest.afterTest(action, waitForTask);
37
- }
38
- execute() {
39
- it(this._testDescription, () => __awaiter(this, void 0, void 0, function* () {
40
- for (let i = 0; i < this._subTests.length; i++) {
41
- yield this._subTests[i].execute();
42
- }
43
- }));
44
- }
45
- }
46
- exports.Test = Test;
47
- class SubTest {
48
- constructor() {
49
- this._beforeTest = [];
50
- this._test = [];
51
- this._afterTest = [];
52
- }
53
- beforeTest(action, waitForTask = false) {
54
- this._beforeTest.push({ action: action, wait: waitForTask });
55
- }
56
- test(action, waitForTask = false) {
57
- this._test.push({ action: action, wait: waitForTask });
58
- }
59
- afterTest(action, waitForTask = false) {
60
- this._afterTest.push({ action: action, wait: waitForTask });
61
- }
62
- static _executeList(list) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- let tmpPromises = [];
65
- for (let i = 0; i < list.length; i++) {
66
- if (list[i].wait) {
67
- if (tmpPromises.length > 0) {
68
- yield Promise.all(tmpPromises);
69
- tmpPromises = [];
70
- }
71
- yield list[i].action();
72
- }
73
- else {
74
- tmpPromises.push(list[i].action());
75
- }
76
- }
77
- if (tmpPromises.length > 0) {
78
- yield Promise.all(tmpPromises);
79
- }
80
- });
81
- }
82
- execute() {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- yield SubTest._executeList(this._beforeTest);
85
- yield SubTest._executeList(this._test);
86
- yield SubTest._executeList(this._afterTest);
87
- });
88
- }
89
- }
@@ -1,24 +0,0 @@
1
- import { Test } from "../test/test";
2
- export default class ActionUtils {
3
- /**
4
- * @description
5
- * This function lets you do an extra action and asserts that no error is thrown.
6
- * When an error throws, it lets the test fail with the provided message or the concrete error.
7
- * @param test
8
- * @param func
9
- * @param failMsg if not provided it throws the specific error.
10
- */
11
- static action(test: Test, func: () => void | Promise<void>, failMsg?: string): void;
12
- /**
13
- * @description
14
- * This function lets you do an extra action and
15
- * asserts that an error or an error instance of a specific class is thrown.
16
- * When no error is thrown, or the error does not match with the given classes
17
- * (only if at least one class is given), it lets the test fail with the provided message.
18
- * @param test
19
- * @param func
20
- * @param message
21
- * @param validErrorClasses
22
- */
23
- static actionShouldThrow(test: Test, func: () => void | Promise<void>, message: string, ...validErrorClasses: any[]): void;
24
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- /*
3
- Author: Luca Scaringella
4
- GitHub: LucaCode
5
- ©Copyright by Luca Scaringella
6
- */
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const assert = require('assert');
18
- class ActionUtils {
19
- // noinspection JSUnusedGlobalSymbols
20
- /**
21
- * @description
22
- * This function lets you do an extra action and asserts that no error is thrown.
23
- * When an error throws, it lets the test fail with the provided message or the concrete error.
24
- * @param test
25
- * @param func
26
- * @param failMsg if not provided it throws the specific error.
27
- */
28
- static action(test, func, failMsg) {
29
- test.test(() => __awaiter(this, void 0, void 0, function* () {
30
- try {
31
- yield func();
32
- }
33
- catch (e) {
34
- assert.fail(failMsg !== undefined ? failMsg : e);
35
- }
36
- }), true);
37
- }
38
- // noinspection JSUnusedGlobalSymbols
39
- /**
40
- * @description
41
- * This function lets you do an extra action and
42
- * asserts that an error or an error instance of a specific class is thrown.
43
- * When no error is thrown, or the error does not match with the given classes
44
- * (only if at least one class is given), it lets the test fail with the provided message.
45
- * @param test
46
- * @param func
47
- * @param message
48
- * @param validErrorClasses
49
- */
50
- static actionShouldThrow(test, func, message, ...validErrorClasses) {
51
- test.test(() => __awaiter(this, void 0, void 0, function* () {
52
- try {
53
- yield func();
54
- assert.fail(message);
55
- }
56
- catch (e) {
57
- let found = validErrorClasses.length === 0;
58
- for (let i = 0; i < validErrorClasses.length; i++) {
59
- if (e instanceof validErrorClasses[i]) {
60
- found = true;
61
- break;
62
- }
63
- }
64
- if (!found)
65
- assert.fail(message);
66
- }
67
- }), true);
68
- }
69
- }
70
- exports.default = ActionUtils;
@@ -1,24 +0,0 @@
1
- import { Test } from "../test/test";
2
- export default class DoUtils {
3
- /**
4
- * @description
5
- * With this function, you can do extra things in the test.
6
- * It asserts that the do-function will not throw an error.
7
- * Subscribe a channel, publish to a channel...
8
- * @param test
9
- * @param func
10
- * @param failMsg if not provided it throws the specific error.
11
- */
12
- static do(test: Test, func: () => void | Promise<void>, failMsg?: string): void;
13
- /**
14
- * @description
15
- * With this function, you can do extra things in the test
16
- * and assert that it should throw an error or a specific error.
17
- * Subscribe a channel, publish to a channel...
18
- * @param test
19
- * @param func
20
- * @param failMsg
21
- * @param errors
22
- */
23
- static doShouldThrow(test: Test, func: () => void | Promise<void>, failMsg: string, ...errors: any[]): void;
24
- }
@@ -1,80 +0,0 @@
1
- "use strict";
2
- /*
3
- Author: Luca Scaringella
4
- GitHub: LucaCode
5
- ©Copyright by Luca Scaringella
6
- */
7
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
- return new (P || (P = Promise))(function (resolve, reject) {
10
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
- step((generator = generator.apply(thisArg, _arguments || [])).next());
14
- });
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- const assert = require('assert');
18
- class DoUtils {
19
- // noinspection JSUnusedGlobalSymbols
20
- /**
21
- * @description
22
- * With this function, you can do extra things in the test.
23
- * It asserts that the do-function will not throw an error.
24
- * Subscribe a channel, publish to a channel...
25
- * @param test
26
- * @param func
27
- * @param failMsg if not provided it throws the specific error.
28
- */
29
- static do(test, func, failMsg) {
30
- test.test(() => __awaiter(this, void 0, void 0, function* () {
31
- try {
32
- yield func();
33
- }
34
- catch (e) {
35
- if (failMsg !== undefined) {
36
- assert.fail(failMsg);
37
- }
38
- else {
39
- throw e;
40
- }
41
- }
42
- }), true);
43
- }
44
- // noinspection JSUnusedGlobalSymbols
45
- /**
46
- * @description
47
- * With this function, you can do extra things in the test
48
- * and assert that it should throw an error or a specific error.
49
- * Subscribe a channel, publish to a channel...
50
- * @param test
51
- * @param func
52
- * @param failMsg
53
- * @param errors
54
- */
55
- static doShouldThrow(test, func, failMsg, ...errors) {
56
- test.test(() => __awaiter(this, void 0, void 0, function* () {
57
- let throws = false;
58
- try {
59
- yield func();
60
- }
61
- catch (e) {
62
- throws = true;
63
- let found = errors.length === 0;
64
- for (let i = 0; i < errors.length; i++) {
65
- if (e instanceof errors[i]) {
66
- found = true;
67
- break;
68
- }
69
- }
70
- if (!found) {
71
- assert.fail(failMsg);
72
- }
73
- }
74
- if (!throws) {
75
- assert.fail(failMsg);
76
- }
77
- }), true);
78
- }
79
- }
80
- exports.default = DoUtils;
@@ -1,13 +0,0 @@
1
- import { AbstractBackErrorFilterBuilder } from "zation-client";
2
- import { ResponseAsserter } from "./../asserter/responseAsserter";
3
- export declare class BackErrorFilterBuilder<T extends ResponseAsserter> extends AbstractBackErrorFilterBuilder<BackErrorFilterBuilder<T>> {
4
- private readonly respAsserter;
5
- private readonly count;
6
- constructor(respAsserter: T, count?: number);
7
- /**
8
- * @description
9
- * End the filter builder.
10
- */
11
- end(): T;
12
- protected self(): BackErrorFilterBuilder<T>;
13
- }