@opra/testing 0.30.0 → 0.30.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.
|
@@ -17,7 +17,7 @@ class ApiExpect extends api_expect_base_js_1.ApiExpectBase {
|
|
|
17
17
|
toSuccess(status) {
|
|
18
18
|
let msg = '';
|
|
19
19
|
try {
|
|
20
|
-
msg += `
|
|
20
|
+
msg += `Status code do not match. `;
|
|
21
21
|
if (status) {
|
|
22
22
|
expect(this.response.status).toEqual(status);
|
|
23
23
|
}
|
|
@@ -27,7 +27,7 @@ class ApiExpect extends api_expect_base_js_1.ApiExpectBase {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
catch (e) {
|
|
30
|
-
e.message = 'Request didn\'t succeeded. ' + msg + '\n\n' + e.message;
|
|
30
|
+
e.message = 'Request didn\'t succeeded as expected. ' + msg + '\n\n' + e.message;
|
|
31
31
|
const issues = this.response.body?.errors;
|
|
32
32
|
const issue = issues?.[0]?.message;
|
|
33
33
|
if (issue) {
|
|
@@ -45,7 +45,7 @@ class ApiExpect extends api_expect_base_js_1.ApiExpectBase {
|
|
|
45
45
|
toFail(status) {
|
|
46
46
|
let msg = '';
|
|
47
47
|
try {
|
|
48
|
-
msg += `
|
|
48
|
+
msg += `Status code do not match. `;
|
|
49
49
|
if (status) {
|
|
50
50
|
expect(this.response.status).toEqual(status);
|
|
51
51
|
}
|
|
@@ -55,7 +55,12 @@ class ApiExpect extends api_expect_base_js_1.ApiExpectBase {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
catch (e) {
|
|
58
|
-
e.message = 'Request didn\'t failed. ' + msg + '\n\n' + e.message;
|
|
58
|
+
e.message = 'Request didn\'t failed as expected. ' + msg + '\n\n' + e.message;
|
|
59
|
+
const issues = this.response.body?.errors;
|
|
60
|
+
const issue = issues?.[0]?.message;
|
|
61
|
+
if (issue) {
|
|
62
|
+
e.message += '\n\n' + ansi_colors_1.default.yellow('Server message: ') + issue;
|
|
63
|
+
}
|
|
59
64
|
Error.captureStackTrace(e, this.toSuccess);
|
|
60
65
|
throw e;
|
|
61
66
|
}
|
|
@@ -13,7 +13,7 @@ export class ApiExpect extends ApiExpectBase {
|
|
|
13
13
|
toSuccess(status) {
|
|
14
14
|
let msg = '';
|
|
15
15
|
try {
|
|
16
|
-
msg += `
|
|
16
|
+
msg += `Status code do not match. `;
|
|
17
17
|
if (status) {
|
|
18
18
|
expect(this.response.status).toEqual(status);
|
|
19
19
|
}
|
|
@@ -23,7 +23,7 @@ export class ApiExpect extends ApiExpectBase {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
catch (e) {
|
|
26
|
-
e.message = 'Request didn\'t succeeded. ' + msg + '\n\n' + e.message;
|
|
26
|
+
e.message = 'Request didn\'t succeeded as expected. ' + msg + '\n\n' + e.message;
|
|
27
27
|
const issues = this.response.body?.errors;
|
|
28
28
|
const issue = issues?.[0]?.message;
|
|
29
29
|
if (issue) {
|
|
@@ -41,7 +41,7 @@ export class ApiExpect extends ApiExpectBase {
|
|
|
41
41
|
toFail(status) {
|
|
42
42
|
let msg = '';
|
|
43
43
|
try {
|
|
44
|
-
msg += `
|
|
44
|
+
msg += `Status code do not match. `;
|
|
45
45
|
if (status) {
|
|
46
46
|
expect(this.response.status).toEqual(status);
|
|
47
47
|
}
|
|
@@ -51,7 +51,12 @@ export class ApiExpect extends ApiExpectBase {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
catch (e) {
|
|
54
|
-
e.message = 'Request didn\'t failed. ' + msg + '\n\n' + e.message;
|
|
54
|
+
e.message = 'Request didn\'t failed as expected. ' + msg + '\n\n' + e.message;
|
|
55
|
+
const issues = this.response.body?.errors;
|
|
56
|
+
const issue = issues?.[0]?.message;
|
|
57
|
+
if (issue) {
|
|
58
|
+
e.message += '\n\n' + colors.yellow('Server message: ') + issue;
|
|
59
|
+
}
|
|
55
60
|
Error.captureStackTrace(e, this.toSuccess);
|
|
56
61
|
throw e;
|
|
57
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/testing",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.1",
|
|
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/client": "^0.30.
|
|
29
|
-
"@opra/common": "^0.30.
|
|
28
|
+
"@opra/client": "^0.30.1",
|
|
29
|
+
"@opra/common": "^0.30.1",
|
|
30
30
|
"ansi-colors": "^4.1.3",
|
|
31
31
|
"lodash.isnil": "^4.0.0",
|
|
32
32
|
"lodash.omitby": "^4.6.0",
|