@opra/testing 0.15.0 → 0.16.0
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/cjs/api-expect/api-expect.js +3 -1
- package/cjs/jest-extend/common.extend.js +1 -1
- package/esm/api-expect/api-expect-collection.js +28 -22
- package/esm/api-expect/api-expect-error.js +12 -7
- package/esm/api-expect/api-expect-object.js +10 -5
- package/esm/api-expect/api-expect-operation-result.js +6 -2
- package/esm/api-expect/api-expect.js +17 -11
- package/esm/index.js +5 -2
- package/esm/jest-extend/common.extend.js +12 -9
- package/esm/jest-extend/index.js +4 -1
- package/esm/test-client.js +15 -13
- package/esm/utils/is-absolute-url.util.js +7 -3
- package/esm/utils/object-matches.util.js +5 -1
- package/package.json +5 -4
- /package/{esm → types}/api-expect/api-expect-collection.d.ts +0 -0
- /package/{esm → types}/api-expect/api-expect-error.d.ts +0 -0
- /package/{esm → types}/api-expect/api-expect-object.d.ts +0 -0
- /package/{esm → types}/api-expect/api-expect-operation-result.d.ts +0 -0
- /package/{esm → types}/api-expect/api-expect.d.ts +0 -0
- /package/{esm → types}/index.d.ts +0 -0
- /package/{esm → types}/jest-extend/common.extend.d.ts +0 -0
- /package/{esm → types}/jest-extend/index.d.ts +0 -0
- /package/{esm → types}/test-client.d.ts +0 -0
- /package/{esm → types}/utils/is-absolute-url.util.d.ts +0 -0
- /package/{esm → types}/utils/object-matches.util.d.ts +0 -0
|
@@ -21,8 +21,10 @@ class ApiExpect {
|
|
|
21
21
|
this._expect(this.response.status).toStrictEqual(status);
|
|
22
22
|
}
|
|
23
23
|
catch (e) {
|
|
24
|
+
const issues = this.response.body?.errors;
|
|
25
|
+
const issue = issues?.[0]?.message;
|
|
24
26
|
if (msg)
|
|
25
|
-
e.message = msg + '\n\n' + e.message;
|
|
27
|
+
e.message = msg + '\n\n' + (issue || e.message);
|
|
26
28
|
Error.captureStackTrace(e, this.toSuccess);
|
|
27
29
|
throw e;
|
|
28
30
|
}
|
|
@@ -10,7 +10,7 @@ expect.extend({
|
|
|
10
10
|
const filteredKeys = expectedKeys.filter(x => !objectKeys.includes(x));
|
|
11
11
|
const pass = !filteredKeys.length === !this.isNot;
|
|
12
12
|
if (!pass) {
|
|
13
|
-
const message = () => `Expects keys
|
|
13
|
+
const message = () => `Expects keys ${this.isNot ? 'not ' : ''}to contain: ${ansi_colors_1.default.yellow('' + expectedKeys)}\n` +
|
|
14
14
|
`${this.isNot ? 'Unsolicited' : 'Missing'} fields: ${ansi_colors_1.default.yellow('' + filteredKeys)}\n`;
|
|
15
15
|
return { message, pass: !!this.isNot };
|
|
16
16
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertFilter = exports.ApiExpectCollection = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("../jest-extend/index.js");
|
|
6
|
+
const lodash_isnil_1 = tslib_1.__importDefault(require("lodash.isnil"));
|
|
7
|
+
const lodash_omitby_1 = tslib_1.__importDefault(require("lodash.omitby"));
|
|
8
|
+
const rule_judgment_1 = tslib_1.__importDefault(require("rule-judgment"));
|
|
9
|
+
const common_1 = require("@opra/common");
|
|
6
10
|
// @ts-ignore
|
|
7
|
-
const ruleJudgment = typeof
|
|
8
|
-
|
|
11
|
+
const ruleJudgment = typeof rule_judgment_1.default === 'object' ? rule_judgment_1.default.default : rule_judgment_1.default;
|
|
12
|
+
class ApiExpectCollection {
|
|
9
13
|
constructor(response, _isNot = false) {
|
|
10
14
|
this.response = response;
|
|
11
15
|
this._isNot = _isNot;
|
|
@@ -19,7 +23,7 @@ export class ApiExpectCollection {
|
|
|
19
23
|
}
|
|
20
24
|
toMatch(expected) {
|
|
21
25
|
try {
|
|
22
|
-
const v =
|
|
26
|
+
const v = (0, lodash_omitby_1.default)(expected, lodash_isnil_1.default);
|
|
23
27
|
for (const item of this.response.body) {
|
|
24
28
|
this._expect(item).toMatchObject(v);
|
|
25
29
|
}
|
|
@@ -129,11 +133,12 @@ export class ApiExpectCollection {
|
|
|
129
133
|
return out;
|
|
130
134
|
}
|
|
131
135
|
}
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
exports.ApiExpectCollection = ApiExpectCollection;
|
|
137
|
+
function convertFilter(str) {
|
|
138
|
+
const ast = typeof str === 'string' ? (0, common_1.parseFilter)(str) : str;
|
|
134
139
|
if (!ast)
|
|
135
140
|
return;
|
|
136
|
-
if (ast instanceof ComparisonExpression) {
|
|
141
|
+
if (ast instanceof common_1.ComparisonExpression) {
|
|
137
142
|
const left = convertFilter(ast.left);
|
|
138
143
|
const right = convertFilter(ast.right);
|
|
139
144
|
switch (ast.op) {
|
|
@@ -157,30 +162,31 @@ export function convertFilter(str) {
|
|
|
157
162
|
throw new Error(`ComparisonExpression operator (${ast.op}) not implemented yet`);
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
|
-
if (ast instanceof QualifiedIdentifier) {
|
|
165
|
+
if (ast instanceof common_1.QualifiedIdentifier) {
|
|
161
166
|
return ast.value;
|
|
162
167
|
}
|
|
163
|
-
if (ast instanceof NumberLiteral ||
|
|
164
|
-
ast instanceof StringLiteral ||
|
|
165
|
-
ast instanceof BooleanLiteral ||
|
|
166
|
-
ast instanceof NullLiteral ||
|
|
167
|
-
ast instanceof DateLiteral ||
|
|
168
|
-
ast instanceof TimeLiteral) {
|
|
168
|
+
if (ast instanceof common_1.NumberLiteral ||
|
|
169
|
+
ast instanceof common_1.StringLiteral ||
|
|
170
|
+
ast instanceof common_1.BooleanLiteral ||
|
|
171
|
+
ast instanceof common_1.NullLiteral ||
|
|
172
|
+
ast instanceof common_1.DateLiteral ||
|
|
173
|
+
ast instanceof common_1.TimeLiteral) {
|
|
169
174
|
return ast.value;
|
|
170
175
|
}
|
|
171
|
-
if (ast instanceof ArrayExpression) {
|
|
176
|
+
if (ast instanceof common_1.ArrayExpression) {
|
|
172
177
|
return ast.items.map(convertFilter);
|
|
173
178
|
}
|
|
174
|
-
if (ast instanceof LogicalExpression) {
|
|
179
|
+
if (ast instanceof common_1.LogicalExpression) {
|
|
175
180
|
if (ast.op === 'or')
|
|
176
181
|
return { $or: ast.items.map(convertFilter) };
|
|
177
182
|
return { $and: ast.items.map(convertFilter) };
|
|
178
183
|
}
|
|
179
|
-
if (ast instanceof ArrayExpression) {
|
|
184
|
+
if (ast instanceof common_1.ArrayExpression) {
|
|
180
185
|
return ast.items.map(convertFilter);
|
|
181
186
|
}
|
|
182
|
-
if (ast instanceof ParenthesesExpression) {
|
|
187
|
+
if (ast instanceof common_1.ParenthesesExpression) {
|
|
183
188
|
return convertFilter(ast.expression);
|
|
184
189
|
}
|
|
185
190
|
throw new Error(`${ast.kind} is not implemented yet`);
|
|
186
191
|
}
|
|
192
|
+
exports.convertFilter = convertFilter;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiExpectError = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("../jest-extend/index.js");
|
|
6
|
+
const jest_matcher_utils_1 = tslib_1.__importDefault(require("jest-matcher-utils"));
|
|
7
|
+
const object_matches_util_js_1 = require("../utils/object-matches.util.js");
|
|
8
|
+
const api_expect_object_js_1 = require("./api-expect-object.js");
|
|
9
|
+
class ApiExpectError extends api_expect_object_js_1.ApiExpectObject {
|
|
6
10
|
constructor(response) {
|
|
7
11
|
super(response);
|
|
8
12
|
this.response = response;
|
|
@@ -19,6 +23,7 @@ export class ApiExpectError extends ApiExpectObject {
|
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
25
|
}
|
|
26
|
+
exports.ApiExpectError = ApiExpectError;
|
|
22
27
|
expect.extend({
|
|
23
28
|
apiErrorDetailToContain(received, issues) {
|
|
24
29
|
try {
|
|
@@ -36,7 +41,7 @@ expect.extend({
|
|
|
36
41
|
for (const detail of received) {
|
|
37
42
|
if (typeof m === 'object') {
|
|
38
43
|
try {
|
|
39
|
-
objectMatches(detail, m);
|
|
44
|
+
(0, object_matches_util_js_1.objectMatches)(detail, m);
|
|
40
45
|
matched = true;
|
|
41
46
|
break;
|
|
42
47
|
}
|
|
@@ -48,7 +53,7 @@ expect.extend({
|
|
|
48
53
|
if (!matched) {
|
|
49
54
|
return {
|
|
50
55
|
pass: false,
|
|
51
|
-
message: () => `Object does not match: \n` +
|
|
56
|
+
message: () => `Object does not match: \n` + jest_matcher_utils_1.default.stringify(m)
|
|
52
57
|
};
|
|
53
58
|
}
|
|
54
59
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiExpectObject = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
require("../jest-extend/index.js");
|
|
6
|
+
const lodash_isnil_1 = tslib_1.__importDefault(require("lodash.isnil"));
|
|
7
|
+
const lodash_omitby_1 = tslib_1.__importDefault(require("lodash.omitby"));
|
|
8
|
+
class ApiExpectObject {
|
|
5
9
|
constructor(response, _isNot = false) {
|
|
6
10
|
this.response = response;
|
|
7
11
|
this._isNot = _isNot;
|
|
@@ -11,7 +15,7 @@ export class ApiExpectObject {
|
|
|
11
15
|
}
|
|
12
16
|
toMatch(expected) {
|
|
13
17
|
try {
|
|
14
|
-
const v =
|
|
18
|
+
const v = (0, lodash_omitby_1.default)(expected, lodash_isnil_1.default);
|
|
15
19
|
this._expect(this.response.body).toMatchObject(v);
|
|
16
20
|
}
|
|
17
21
|
catch (e) {
|
|
@@ -47,3 +51,4 @@ export class ApiExpectObject {
|
|
|
47
51
|
return out;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
54
|
+
exports.ApiExpectObject = ApiExpectObject;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiExpectOperationResult = void 0;
|
|
4
|
+
require("../jest-extend/index.js");
|
|
5
|
+
class ApiExpectOperationResult {
|
|
3
6
|
constructor(response, _isNot = false) {
|
|
4
7
|
this.response = response;
|
|
5
8
|
this._isNot = _isNot;
|
|
@@ -44,3 +47,4 @@ export class ApiExpectOperationResult {
|
|
|
44
47
|
return out;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
50
|
+
exports.ApiExpectOperationResult = ApiExpectOperationResult;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiExpect = void 0;
|
|
4
|
+
require("../jest-extend/index.js");
|
|
5
|
+
const api_expect_collection_js_1 = require("./api-expect-collection.js");
|
|
6
|
+
const api_expect_error_js_1 = require("./api-expect-error.js");
|
|
7
|
+
const api_expect_object_js_1 = require("./api-expect-object.js");
|
|
8
|
+
const api_expect_operation_result_js_1 = require("./api-expect-operation-result.js");
|
|
9
|
+
class ApiExpect {
|
|
7
10
|
constructor(response, _isNot = false) {
|
|
8
11
|
this.response = response;
|
|
9
12
|
this._isNot = _isNot;
|
|
@@ -18,8 +21,10 @@ export class ApiExpect {
|
|
|
18
21
|
this._expect(this.response.status).toStrictEqual(status);
|
|
19
22
|
}
|
|
20
23
|
catch (e) {
|
|
24
|
+
const issues = this.response.body?.errors;
|
|
25
|
+
const issue = issues?.[0]?.message;
|
|
21
26
|
if (msg)
|
|
22
|
-
e.message = msg + '\n\n' + e.message;
|
|
27
|
+
e.message = msg + '\n\n' + (issue || e.message);
|
|
23
28
|
Error.captureStackTrace(e, this.toSuccess);
|
|
24
29
|
throw e;
|
|
25
30
|
}
|
|
@@ -46,7 +51,7 @@ export class ApiExpect {
|
|
|
46
51
|
Error.captureStackTrace(e, this.toFail);
|
|
47
52
|
throw e;
|
|
48
53
|
}
|
|
49
|
-
return new ApiExpectError(this.response);
|
|
54
|
+
return new api_expect_error_js_1.ApiExpectError(this.response);
|
|
50
55
|
}
|
|
51
56
|
toReturnOperationResult() {
|
|
52
57
|
let msg = '';
|
|
@@ -62,7 +67,7 @@ export class ApiExpect {
|
|
|
62
67
|
Error.captureStackTrace(e, this.toReturnOperationResult);
|
|
63
68
|
throw e;
|
|
64
69
|
}
|
|
65
|
-
return new ApiExpectOperationResult(this.response);
|
|
70
|
+
return new api_expect_operation_result_js_1.ApiExpectOperationResult(this.response);
|
|
66
71
|
}
|
|
67
72
|
toReturnObject() {
|
|
68
73
|
let msg = '';
|
|
@@ -77,7 +82,7 @@ export class ApiExpect {
|
|
|
77
82
|
Error.captureStackTrace(e, this.toReturnObject);
|
|
78
83
|
throw e;
|
|
79
84
|
}
|
|
80
|
-
return new ApiExpectObject(this.response);
|
|
85
|
+
return new api_expect_object_js_1.ApiExpectObject(this.response);
|
|
81
86
|
}
|
|
82
87
|
toReturnCollection() {
|
|
83
88
|
let msg = '';
|
|
@@ -93,7 +98,7 @@ export class ApiExpect {
|
|
|
93
98
|
Error.captureStackTrace(e, this.toReturnCollection);
|
|
94
99
|
throw e;
|
|
95
100
|
}
|
|
96
|
-
return new ApiExpectCollection(this.response);
|
|
101
|
+
return new api_expect_collection_js_1.ApiExpectCollection(this.response);
|
|
97
102
|
}
|
|
98
103
|
_expect(expected) {
|
|
99
104
|
const out = expect(expected);
|
|
@@ -102,3 +107,4 @@ export class ApiExpect {
|
|
|
102
107
|
return out;
|
|
103
108
|
}
|
|
104
109
|
}
|
|
110
|
+
exports.ApiExpect = ApiExpect;
|
package/esm/index.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
require("./jest-extend/index.js");
|
|
5
|
+
tslib_1.__exportStar(require("./test-client.js"), exports);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const ansi_colors_1 = tslib_1.__importDefault(require("ansi-colors"));
|
|
5
|
+
const jest_matcher_utils_1 = require("jest-matcher-utils");
|
|
3
6
|
expect.extend({
|
|
4
7
|
toHaveFields(received, expected) {
|
|
5
8
|
const expectedKeys = (Array.isArray(expected) ? expected : Object.keys(expected)).map(x => x.toLowerCase());
|
|
@@ -7,8 +10,8 @@ expect.extend({
|
|
|
7
10
|
const filteredKeys = expectedKeys.filter(x => !objectKeys.includes(x));
|
|
8
11
|
const pass = !filteredKeys.length === !this.isNot;
|
|
9
12
|
if (!pass) {
|
|
10
|
-
const message = () => `Expects keys
|
|
11
|
-
`${this.isNot ? 'Unsolicited' : 'Missing'} fields: ${
|
|
13
|
+
const message = () => `Expects keys ${this.isNot ? 'not ' : ''}to contain: ${ansi_colors_1.default.yellow('' + expectedKeys)}\n` +
|
|
14
|
+
`${this.isNot ? 'Unsolicited' : 'Missing'} fields: ${ansi_colors_1.default.yellow('' + filteredKeys)}\n`;
|
|
12
15
|
return { message, pass: !!this.isNot };
|
|
13
16
|
}
|
|
14
17
|
return { actual: received, pass: !this.isNot, message: () => '' };
|
|
@@ -19,8 +22,8 @@ expect.extend({
|
|
|
19
22
|
const filteredKeys = objectKeys.filter(x => !expectedKeys.includes(x));
|
|
20
23
|
const pass = !filteredKeys.length === !this.isNot;
|
|
21
24
|
if (!pass) {
|
|
22
|
-
const message = () => `${!this.isNot ? 'Do not expects' : 'Expects'} additional keys other than: ${
|
|
23
|
-
(filteredKeys ? `Additional keys received: ${
|
|
25
|
+
const message = () => `${!this.isNot ? 'Do not expects' : 'Expects'} additional keys other than: ${ansi_colors_1.default.yellow('' + expectedKeys)}\n` +
|
|
26
|
+
(filteredKeys ? `Additional keys received: ${ansi_colors_1.default.yellow('' + filteredKeys)}\n` :
|
|
24
27
|
'No additional keys received\n');
|
|
25
28
|
return { message, pass };
|
|
26
29
|
}
|
|
@@ -121,9 +124,9 @@ expect.extend({
|
|
|
121
124
|
});
|
|
122
125
|
function compare(matcherName, options, received, expected, operator, fn) {
|
|
123
126
|
const pass = fn(received, expected);
|
|
124
|
-
const message = () => matcherHint(matcherName, undefined, undefined, options) +
|
|
127
|
+
const message = () => (0, jest_matcher_utils_1.matcherHint)(matcherName, undefined, undefined, options) +
|
|
125
128
|
'\n\n' +
|
|
126
|
-
`Expected:${options.isNot ? ' not' : ''} ${operator} ${printExpected(expected)}\n` +
|
|
127
|
-
`Received:${options.isNot ? ' ' : ''} ${printReceived(received)}`;
|
|
129
|
+
`Expected:${options.isNot ? ' not' : ''} ${operator} ${(0, jest_matcher_utils_1.printExpected)(expected)}\n` +
|
|
130
|
+
`Received:${options.isNot ? ' ' : ''} ${(0, jest_matcher_utils_1.printReceived)(received)}`;
|
|
128
131
|
return { message, pass };
|
|
129
132
|
}
|
package/esm/jest-extend/index.js
CHANGED
package/esm/test-client.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpraTestClient = void 0;
|
|
4
|
+
const http_1 = require("http");
|
|
5
|
+
const url_1 = require("url");
|
|
6
|
+
const common_1 = require("@opra/common");
|
|
7
|
+
const node_client_1 = require("@opra/node-client");
|
|
8
|
+
const api_expect_js_1 = require("./api-expect/api-expect.js");
|
|
9
|
+
const is_absolute_url_util_js_1 = require("./utils/is-absolute-url.util.js");
|
|
10
|
+
class OpraTestClient extends node_client_1.OpraHttpClient {
|
|
10
11
|
constructor(app, options) {
|
|
11
12
|
super('/', options);
|
|
12
|
-
this._server = app instanceof Server ? app : createServer(app);
|
|
13
|
+
this._server = app instanceof http_1.Server ? app : (0, http_1.createServer)(app);
|
|
13
14
|
}
|
|
14
15
|
collection(resourceName) {
|
|
15
16
|
return super.collection(resourceName);
|
|
@@ -19,8 +20,8 @@ export class OpraTestClient extends OpraHttpClient {
|
|
|
19
20
|
}
|
|
20
21
|
async _fetch(urlString, req = {}) {
|
|
21
22
|
return new Promise((resolve, reject) => {
|
|
22
|
-
urlString = isAbsoluteUrl(urlString) ? urlString : joinPath('http://opra.test', urlString);
|
|
23
|
-
const url = new URL(urlString);
|
|
23
|
+
urlString = (0, is_absolute_url_util_js_1.isAbsoluteUrl)(urlString) ? urlString : (0, common_1.joinPath)('http://opra.test', urlString);
|
|
24
|
+
const url = new url_1.URL(urlString);
|
|
24
25
|
// Set protocol to HTTP
|
|
25
26
|
url.protocol = 'http';
|
|
26
27
|
// Apply original host to request header
|
|
@@ -55,7 +56,8 @@ export class OpraTestClient extends OpraHttpClient {
|
|
|
55
56
|
}
|
|
56
57
|
_createResponse(init) {
|
|
57
58
|
const resp = super._createResponse(init);
|
|
58
|
-
resp.expect = new ApiExpect(resp);
|
|
59
|
+
resp.expect = new api_expect_js_1.ApiExpect(resp);
|
|
59
60
|
return resp;
|
|
60
61
|
}
|
|
61
62
|
}
|
|
63
|
+
exports.OpraTestClient = OpraTestClient;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAbsoluteUrl = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
const isAbsoluteUrl = (urlString) => {
|
|
6
|
+
const url = new url_1.URL(urlString, 'http://opra.test/');
|
|
4
7
|
return url.host !== 'opra.test';
|
|
5
8
|
};
|
|
9
|
+
exports.isAbsoluteUrl = isAbsoluteUrl;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objectMatches = void 0;
|
|
4
|
+
function objectMatches(received, expected) {
|
|
2
5
|
_objectMatches(received, expected, '');
|
|
3
6
|
}
|
|
7
|
+
exports.objectMatches = objectMatches;
|
|
4
8
|
function _objectMatches(received, expected, path) {
|
|
5
9
|
if (typeof received !== typeof expected)
|
|
6
10
|
expect(typeof received).toStrictEqual('object');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Opra testing package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"clean:cover": "rimraf ../../coverage/testing"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opra/common": "^0.
|
|
29
|
-
"@opra/node-client": "^0.
|
|
28
|
+
"@opra/common": "^0.16.0",
|
|
29
|
+
"@opra/node-client": "^0.16.0",
|
|
30
30
|
"ansi-colors": "^4.1.3",
|
|
31
31
|
"lodash.isnil": "^4.0.0",
|
|
32
32
|
"lodash.omitby": "^4.6.0",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/supertest": "^2.0.12"
|
|
37
37
|
},
|
|
38
38
|
"type": "module",
|
|
39
|
-
"types": "
|
|
39
|
+
"types": "types/index.d.ts",
|
|
40
40
|
"exports": {
|
|
41
41
|
".": {
|
|
42
42
|
"require": "./cjs/index.js",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"bin/",
|
|
54
54
|
"cjs/",
|
|
55
55
|
"esm/",
|
|
56
|
+
"types/",
|
|
56
57
|
"LICENSE",
|
|
57
58
|
"README.md"
|
|
58
59
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|