@serenity-js/rest 2.32.4 → 3.0.0-rc.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/CHANGELOG.md CHANGED
@@ -3,6 +3,52 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
7
+
8
+ **Note:** Version bump only for package @serenity-js/rest
9
+
10
+
11
+
12
+
13
+
14
+ # [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
15
+
16
+ **Note:** Version bump only for package @serenity-js/rest
17
+
18
+
19
+
20
+
21
+
22
+ # [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
28
+
29
+
30
+ ### Features
31
+
32
+ * **core:** question.about produces "props" that proxy the methods of the underlying model ([f771872](https://github.com/serenity-js/serenity-js/commit/f771872c56b487e404002c3800fc8f3baaed804f))
33
+
34
+
35
+ ### BREAKING CHANGES
36
+
37
+ * **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
38
+ modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
39
+
40
+
41
+
42
+
43
+
44
+ ## [2.32.5](https://github.com/serenity-js/serenity-js/compare/v2.32.4...v2.32.5) (2021-12-08)
45
+
46
+ **Note:** Version bump only for package @serenity-js/rest
47
+
48
+
49
+
50
+
51
+
6
52
  ## [2.32.4](https://github.com/serenity-js/serenity-js/compare/v2.32.3...v2.32.4) (2021-11-25)
7
53
 
8
54
  **Note:** Version bump only for package @serenity-js/rest
@@ -12,6 +12,7 @@ export declare abstract class HTTPRequest extends Question<Promise<AxiosRequestC
12
12
  protected readonly resourceUri?: Answerable<string>;
13
13
  protected readonly data?: Answerable<any>;
14
14
  protected readonly config?: Answerable<AxiosRequestConfig>;
15
+ private subject;
15
16
  /**
16
17
  * @protected
17
18
  *
@@ -34,6 +35,15 @@ export declare abstract class HTTPRequest extends Question<Promise<AxiosRequestC
34
35
  * @returns {Promise<AxiosRequestConfig>}
35
36
  */
36
37
  answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<AxiosRequestConfig>;
38
+ /**
39
+ * @desc
40
+ * Changes the description of this question's subject.
41
+ *
42
+ * @param {string} subject
43
+ * @returns {Question<T>}
44
+ */
45
+ describedAs(subject: string): this;
46
+ toString(): string;
37
47
  /**
38
48
  * Determines the request method based on the name of the request class.
39
49
  * For example: GetRequest => GET, PostRequest => POST, etc.
@@ -26,7 +26,7 @@ class HTTPRequest extends core_1.Question {
26
26
  * provided when the {@link CallAnApi} {@link @serenity-js/core/lib/screenplay~Ability} is instantiated
27
27
  */
28
28
  constructor(resourceUri, data, config) {
29
- super('');
29
+ super();
30
30
  this.resourceUri = resourceUri;
31
31
  this.data = data;
32
32
  this.config = config;
@@ -55,6 +55,20 @@ class HTTPRequest extends core_1.Question {
55
55
  return acc;
56
56
  }, {}));
57
57
  }
58
+ /**
59
+ * @desc
60
+ * Changes the description of this question's subject.
61
+ *
62
+ * @param {string} subject
63
+ * @returns {Question<T>}
64
+ */
65
+ describedAs(subject) {
66
+ this.subject = subject;
67
+ return this;
68
+ }
69
+ toString() {
70
+ return this.subject;
71
+ }
58
72
  /**
59
73
  * Determines the request method based on the name of the request class.
60
74
  * For example: GetRequest => GET, PostRequest => POST, etc.
@@ -1 +1 @@
1
- {"version":3,"file":"HTTPRequest.js","sourceRoot":"","sources":["../../src/model/HTTPRequest.ts"],"names":[],"mappings":";;;AAAA,4CAA0F;AAC1F,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AI,CAAC;IAChB,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACK,cAAc;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACtE,CAAC;IAED;;OAEG;IACK,kBAAkB;QACtB,MACI,MAAM,GAAG,CAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAE,EACpC,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAEnC,OAAO,GAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAI,IAAK,MAAO,UAAU,CAAC;IAC9E,CAAC;CACJ;AA7FD,kCA6FC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serenity-js/rest",
3
- "version": "2.32.4",
3
+ "version": "3.0.0-rc.2",
4
4
  "description": "Test REST APIs with Serenity/JS",
5
5
  "author": {
6
6
  "name": "Jan Molak",
@@ -29,7 +29,7 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "clean": "rimraf .nyc_output lib target",
32
- "lint": "eslint --ext ts --config ../../.eslintrc.js .",
32
+ "lint": "eslint --ext ts --config ../../.eslintrc.yml .",
33
33
  "lint:fix": "npm run lint -- --fix",
34
34
  "test": "nyc --report-dir ../../target/coverage/rest mocha --config ../../.mocharc.yml 'spec/**/*.spec.*'",
35
35
  "compile": "tsc --project tsconfig.json",
@@ -43,18 +43,18 @@
43
43
  "url": "https://github.com/serenity-js/serenity-js/issues"
44
44
  },
45
45
  "engines": {
46
- "node": "^12 || ^14 || ^16",
46
+ "node": "^14 || ^16",
47
47
  "npm": "^6 || ^7 || ^8"
48
48
  },
49
49
  "dependencies": {
50
- "@serenity-js/core": "2.32.4",
50
+ "@serenity-js/core": "3.0.0-rc.1",
51
51
  "axios": "^0.21.4"
52
52
  },
53
53
  "devDependencies": {
54
- "@documentation/esdoc-template": "2.0.0",
55
- "@integration/testing-tools": "2.0.0",
56
- "@serenity-js/assertions": "2.32.4",
57
- "@types/chai": "^4.2.22",
54
+ "@documentation/esdoc-template": "3.0.0",
55
+ "@integration/testing-tools": "3.0.0",
56
+ "@serenity-js/assertions": "3.0.0-rc.2",
57
+ "@types/chai": "^4.3.0",
58
58
  "@types/mocha": "^9.0.0",
59
59
  "axios-mock-adapter": "^1.20.0",
60
60
  "mocha": "^9.1.3",
@@ -83,5 +83,5 @@
83
83
  "cache": true,
84
84
  "all": true
85
85
  },
86
- "gitHead": "0c706f753343f1ce35b7e77460062d5762f6d4aa"
86
+ "gitHead": "944ff400a3766e75980aea5d3b401d8acca7c6d8"
87
87
  }
@@ -12,6 +12,8 @@ import { AxiosRequestConfig } from 'axios';
12
12
  */
13
13
  export abstract class HTTPRequest extends Question<Promise<AxiosRequestConfig>> {
14
14
 
15
+ private subject: string;
16
+
15
17
  /**
16
18
  * @protected
17
19
  *
@@ -30,7 +32,7 @@ export abstract class HTTPRequest extends Question<Promise<AxiosRequestConfig>>
30
32
  protected readonly data?: Answerable<any>,
31
33
  protected readonly config?: Answerable<AxiosRequestConfig>,
32
34
  ) {
33
- super('');
35
+ super();
34
36
  this.subject = `${ this.requestDescription() } to ${ formatted `${ this.resourceUri }` }`;
35
37
  }
36
38
 
@@ -67,6 +69,22 @@ export abstract class HTTPRequest extends Question<Promise<AxiosRequestConfig>>
67
69
  );
68
70
  }
69
71
 
72
+ /**
73
+ * @desc
74
+ * Changes the description of this question's subject.
75
+ *
76
+ * @param {string} subject
77
+ * @returns {Question<T>}
78
+ */
79
+ describedAs(subject: string): this {
80
+ this.subject = subject;
81
+ return this;
82
+ }
83
+
84
+ toString(): string {
85
+ return this.subject;
86
+ }
87
+
70
88
  /**
71
89
  * Determines the request method based on the name of the request class.
72
90
  * For example: GetRequest => GET, PostRequest => POST, etc.