zation-assured 3.0.0-dev.1 → 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.
- package/dist/lib/api/assert.d.ts +5 -5
- package/dist/lib/api/assert.js +3 -3
- package/dist/lib/helper/asserter/controller/integratedResponseAsserter.d.ts +1 -1
- package/dist/lib/helper/asserter/controller/standaloneResponseAsserter.d.ts +1 -1
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.d.ts +5 -5
- package/dist/lib/helper/asserter/databox/abstractDataboxAsserter.js +5 -5
- package/dist/lib/helper/asserter/value/abstractValueAsserter.d.ts +5 -5
- package/dist/lib/helper/asserter/value/abstractValueAsserter.js +5 -5
- package/package.json +3 -3
package/dist/lib/api/assert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandaloneClientAsserter } from "../helper/asserter/client/standaloneClientAsserter";
|
|
2
2
|
import { Channel, Databox, Client, Response } from "zation-client";
|
|
3
|
-
import {
|
|
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";
|
|
@@ -46,19 +46,19 @@ export declare const assert: {
|
|
|
46
46
|
*/
|
|
47
47
|
channel: <C extends Channel<any, any>>(channel: C | C[], description?: string) => StandaloneChannelAsserter<C>;
|
|
48
48
|
/**
|
|
49
|
-
* 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.
|
|
50
50
|
* @param promise
|
|
51
51
|
* @param query
|
|
52
52
|
* @param message
|
|
53
53
|
*/
|
|
54
|
-
rejects: (promise: Promise<any>, query:
|
|
54
|
+
rejects: (promise: Promise<any>, query: Query, message?: string | Error) => Promise<void>;
|
|
55
55
|
/**
|
|
56
|
-
* 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.
|
|
57
57
|
* @param promise
|
|
58
58
|
* @param query
|
|
59
59
|
* @param message
|
|
60
60
|
*/
|
|
61
|
-
resolves: (promise: Promise<any>, query:
|
|
61
|
+
resolves: (promise: Promise<any>, query: Query, message?: string | Error) => Promise<void>;
|
|
62
62
|
/**
|
|
63
63
|
* Lets the test failing.
|
|
64
64
|
* @param message
|
package/dist/lib/api/assert.js
CHANGED
|
@@ -8,7 +8,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");
|
|
@@ -37,7 +37,7 @@ exports.assert.rejects = (promise, query, message) => {
|
|
|
37
37
|
assertFunc.fail(message);
|
|
38
38
|
r();
|
|
39
39
|
}, (err) => {
|
|
40
|
-
(0, exports.assert)((0,
|
|
40
|
+
(0, exports.assert)((0, queric_1.default)(query)(err), message);
|
|
41
41
|
r();
|
|
42
42
|
});
|
|
43
43
|
});
|
|
@@ -45,7 +45,7 @@ exports.assert.rejects = (promise, query, message) => {
|
|
|
45
45
|
exports.assert.resolves = (promise, query, message) => {
|
|
46
46
|
return new Promise(r => {
|
|
47
47
|
promise.then((res) => {
|
|
48
|
-
(0, exports.assert)((0,
|
|
48
|
+
(0, exports.assert)((0, queric_1.default)(query)(res), message);
|
|
49
49
|
r();
|
|
50
50
|
}, () => {
|
|
51
51
|
assertFunc.fail(message);
|
|
@@ -39,7 +39,7 @@ export declare class IntegratedResponseAsserter<R extends Response<any>, C exten
|
|
|
39
39
|
* @description
|
|
40
40
|
* Asserts that the response has specific errors with a raw filter.
|
|
41
41
|
* @param filter
|
|
42
|
-
*
|
|
42
|
+
* Queric filter to filter for specific errors.
|
|
43
43
|
*/
|
|
44
44
|
hasError(filter: BackErrorFilter): IntegratedResponseAsserter<R, C>;
|
|
45
45
|
/**
|
|
@@ -37,7 +37,7 @@ export default class StandaloneResponseAsserter<R extends Response<any>> {
|
|
|
37
37
|
* @description
|
|
38
38
|
* Asserts that the response has specific errors with a raw filter.
|
|
39
39
|
* @param filter
|
|
40
|
-
*
|
|
40
|
+
* Queric filter to filter for specific errors.
|
|
41
41
|
*/
|
|
42
42
|
hasError(filter: BackErrorFilter): StandaloneResponseAsserter<R>;
|
|
43
43
|
/**
|
|
@@ -3,7 +3,7 @@ import { Databox, DataEventReason, DbStorage } from 'zation-client';
|
|
|
3
3
|
import { DataEventAsserter } from "../event/dataEventAsserter";
|
|
4
4
|
import { ValueAsserter } from "../value/valueAsserter";
|
|
5
5
|
import { CodeMetadataEventAsserter } from "../event/codeMetadataEventAsserter";
|
|
6
|
-
import {
|
|
6
|
+
import { Query } from "queric";
|
|
7
7
|
import { DataboxData, DataboxFetchData, DataboxMember } from "../../utils/types";
|
|
8
8
|
import { DeepReadonly } from "../../utils/types";
|
|
9
9
|
export declare abstract class AbstractDataboxAsserter<T, D extends Databox<any, any, any, any>> {
|
|
@@ -50,15 +50,15 @@ export declare abstract class AbstractDataboxAsserter<T, D extends Databox<any,
|
|
|
50
50
|
/**
|
|
51
51
|
* @description
|
|
52
52
|
* Asserts that the databox should trigger an data change event.
|
|
53
|
-
* It is also possible to filter for specific data event reasons with a
|
|
53
|
+
* It is also possible to filter for specific data event reasons with a queric query.
|
|
54
54
|
*/
|
|
55
|
-
dataChangeTriggers(reasonFilter?:
|
|
55
|
+
dataChangeTriggers(reasonFilter?: Query<DataEventReason>): DataEventAsserter<T, [DeepReadonly<DataboxData<D>>, DataEventReason, DbStorage<DataboxData<D>>], 0>;
|
|
56
56
|
/**
|
|
57
57
|
* @description
|
|
58
58
|
* Asserts that the databox should trigger an data touch event.
|
|
59
|
-
* It is also possible to filter for specific data event reasons with a
|
|
59
|
+
* It is also possible to filter for specific data event reasons with a queric query.
|
|
60
60
|
*/
|
|
61
|
-
dataTouchTriggers(reasonFilter?:
|
|
61
|
+
dataTouchTriggers(reasonFilter?: Query<DataEventReason>): DataEventAsserter<T, [DeepReadonly<DataboxData<D>>, DataEventReason, DbStorage<DataboxData<D>>], 0>;
|
|
62
62
|
/**
|
|
63
63
|
* @description
|
|
64
64
|
* Asserts that the databox should trigger an close event.
|
|
@@ -21,7 +21,7 @@ const dataEventAsserter_1 = require("../event/dataEventAsserter");
|
|
|
21
21
|
const valueAsserter_1 = require("../value/valueAsserter");
|
|
22
22
|
const codeMetadataEventAsserter_1 = require("../event/codeMetadataEventAsserter");
|
|
23
23
|
const chai_1 = require("chai");
|
|
24
|
-
const
|
|
24
|
+
const queric_1 = require("queric");
|
|
25
25
|
class AbstractDataboxAsserter {
|
|
26
26
|
constructor(databoxes, test) {
|
|
27
27
|
this._test = test;
|
|
@@ -134,10 +134,10 @@ class AbstractDataboxAsserter {
|
|
|
134
134
|
/**
|
|
135
135
|
* @description
|
|
136
136
|
* Asserts that the databox should trigger an data change event.
|
|
137
|
-
* It is also possible to filter for specific data event reasons with a
|
|
137
|
+
* It is also possible to filter for specific data event reasons with a queric query.
|
|
138
138
|
*/
|
|
139
139
|
dataChangeTriggers(reasonFilter) {
|
|
140
|
-
const filter = reasonFilter ? (0,
|
|
140
|
+
const filter = reasonFilter ? (0, queric_1.default)(reasonFilter) : () => true;
|
|
141
141
|
return new dataEventAsserter_1.DataEventAsserter(this.databoxes.map(d => {
|
|
142
142
|
return (listener) => {
|
|
143
143
|
let handler;
|
|
@@ -154,10 +154,10 @@ class AbstractDataboxAsserter {
|
|
|
154
154
|
/**
|
|
155
155
|
* @description
|
|
156
156
|
* Asserts that the databox should trigger an data touch event.
|
|
157
|
-
* It is also possible to filter for specific data event reasons with a
|
|
157
|
+
* It is also possible to filter for specific data event reasons with a queric query.
|
|
158
158
|
*/
|
|
159
159
|
dataTouchTriggers(reasonFilter) {
|
|
160
|
-
const filter = reasonFilter ? (0,
|
|
160
|
+
const filter = reasonFilter ? (0, queric_1.default)(reasonFilter) : () => true;
|
|
161
161
|
return new dataEventAsserter_1.DataEventAsserter(this.databoxes.map(d => {
|
|
162
162
|
return (listener) => {
|
|
163
163
|
let handler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Query } from "queric";
|
|
2
2
|
declare type AddTest = (test: (value: any, target: string) => void) => void;
|
|
3
3
|
export declare abstract class AbstractValueAsserter<V, T> {
|
|
4
4
|
protected abstract self(): T;
|
|
@@ -63,13 +63,13 @@ export declare abstract class AbstractValueAsserter<V, T> {
|
|
|
63
63
|
*/
|
|
64
64
|
notDeepEqual(expectedValue: any): T;
|
|
65
65
|
/**
|
|
66
|
-
* Asserts that the value matches with a
|
|
66
|
+
* Asserts that the value matches with a queric query.
|
|
67
67
|
*/
|
|
68
|
-
matches(query:
|
|
68
|
+
matches(query: Query<V> | Query<Record<any, any>>): T;
|
|
69
69
|
/**
|
|
70
|
-
* Asserts that the value not matches with a
|
|
70
|
+
* Asserts that the value not matches with a queric query.
|
|
71
71
|
*/
|
|
72
|
-
notMatches(query:
|
|
72
|
+
notMatches(query: Query<V> | Query<Record<any, any>>): T;
|
|
73
73
|
/**
|
|
74
74
|
* @description
|
|
75
75
|
* Asserts that the value has all specific keys.
|
|
@@ -15,7 +15,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.AbstractValueAsserter = void 0;
|
|
18
|
-
const
|
|
18
|
+
const queric_1 = require("queric");
|
|
19
19
|
const chai_1 = require("chai");
|
|
20
20
|
class AbstractValueAsserter {
|
|
21
21
|
constructor(addTest) {
|
|
@@ -141,21 +141,21 @@ class AbstractValueAsserter {
|
|
|
141
141
|
}
|
|
142
142
|
// noinspection JSUnusedGlobalSymbols
|
|
143
143
|
/**
|
|
144
|
-
* Asserts that the value matches with a
|
|
144
|
+
* Asserts that the value matches with a queric query.
|
|
145
145
|
*/
|
|
146
146
|
matches(query) {
|
|
147
147
|
this.addTest((inAny, target) => __awaiter(this, void 0, void 0, function* () {
|
|
148
|
-
yield (0, chai_1.assert)((0,
|
|
148
|
+
yield (0, chai_1.assert)((0, queric_1.default)(query)(inAny), `${target} should match with the queric query.`);
|
|
149
149
|
}));
|
|
150
150
|
return this.self();
|
|
151
151
|
}
|
|
152
152
|
// noinspection JSUnusedGlobalSymbols
|
|
153
153
|
/**
|
|
154
|
-
* Asserts that the value not matches with a
|
|
154
|
+
* Asserts that the value not matches with a queric query.
|
|
155
155
|
*/
|
|
156
156
|
notMatches(query) {
|
|
157
157
|
this.addTest((inAny, target) => __awaiter(this, void 0, void 0, function* () {
|
|
158
|
-
yield (0, chai_1.assert)(!(0,
|
|
158
|
+
yield (0, chai_1.assert)(!(0, queric_1.default)(query)(inAny), `${target} should not match with the queric query.`);
|
|
159
159
|
}));
|
|
160
160
|
return this.self();
|
|
161
161
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zation-assured",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Library For Testing Zation Servers",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@types/node": "^12.7.2",
|
|
43
43
|
"chai": "^4.3.3",
|
|
44
44
|
"path": "0.12.7",
|
|
45
|
-
"zation-client": "^3.0.0-dev.
|
|
46
|
-
"
|
|
45
|
+
"zation-client": "^3.0.0-dev.4",
|
|
46
|
+
"queric": "^2.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"gulp": "4.0.0",
|