@serenity-js/rest
Advanced tools
Comparing version 3.23.2 to 3.24.0
@@ -6,2 +6,13 @@ # Change Log | ||
# [3.24.0](https://github.com/serenity-js/serenity-js/compare/v3.23.2...v3.24.0) (2024-06-18) | ||
### Features | ||
* **core:** support for dynamic descriptions for Questions ([aac9a8f](https://github.com/serenity-js/serenity-js/commit/aac9a8f5dbc5b6f4664373f5462aa171baecdcf8)), closes [#2223](https://github.com/serenity-js/serenity-js/issues/2223) | ||
## [3.23.2](https://github.com/serenity-js/serenity-js/compare/v3.23.1...v3.23.2) (2024-05-24) | ||
@@ -8,0 +19,0 @@ |
@@ -14,3 +14,2 @@ import type { Answerable, AnswersQuestions, UsesAbilities, WithAnswerableProperties } from '@serenity-js/core'; | ||
protected readonly config?: Answerable<WithAnswerableProperties<AxiosRequestConfig>>; | ||
private subject; | ||
/** | ||
@@ -33,19 +32,11 @@ * @param [resourceUri] | ||
/** | ||
* @inheritDoc | ||
*/ | ||
describedAs(subject: string): this; | ||
/** | ||
* @inheritDoc | ||
*/ | ||
toString(): string; | ||
/** | ||
* Determines the request method based on the name of the request class. | ||
* For example: GetRequest => GET, PostRequest => POST, etc. | ||
*/ | ||
private httpMethodName; | ||
private static httpMethodName; | ||
/** | ||
* A human-readable description of the request, such as "a GET request", "an OPTIONS request", etc. | ||
*/ | ||
private requestDescription; | ||
private static requestDescription; | ||
} | ||
//# sourceMappingURL=HTTPRequest.d.ts.map |
@@ -16,3 +16,2 @@ "use strict"; | ||
config; | ||
subject; | ||
/** | ||
@@ -30,7 +29,6 @@ * @param [resourceUri] | ||
constructor(resourceUri, data, config) { | ||
super(); | ||
super(`${HTTPRequest.requestDescription(new.target.name)} to ${(0, io_1.d) `${resourceUri}`}`); | ||
this.resourceUri = resourceUri; | ||
this.data = data; | ||
this.config = config; | ||
this.subject = `${this.requestDescription()} to ${(0, io_1.d) `${this.resourceUri}`}`; | ||
} | ||
@@ -46,3 +44,3 @@ /** | ||
]). | ||
then(([url, config, data]) => Object.assign({}, { url, data }, config, { method: this.httpMethodName() })). | ||
then(([url, config, data]) => Object.assign({}, { url, data }, config, { method: HTTPRequest.httpMethodName(this.constructor.name) })). | ||
then(config => | ||
@@ -58,20 +56,7 @@ // eslint-disable-next-line unicorn/prefer-object-from-entries | ||
/** | ||
* @inheritDoc | ||
*/ | ||
describedAs(subject) { | ||
this.subject = subject; | ||
return this; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
toString() { | ||
return this.subject; | ||
} | ||
/** | ||
* Determines the request method based on the name of the request class. | ||
* For example: GetRequest => GET, PostRequest => POST, etc. | ||
*/ | ||
httpMethodName() { | ||
return this.constructor.name.replace(/Request/, '').toUpperCase(); | ||
static httpMethodName(className) { | ||
return className.replace(/Request/, '').toUpperCase(); | ||
} | ||
@@ -81,4 +66,4 @@ /** | ||
*/ | ||
requestDescription() { | ||
const vowels = ['A', 'E', 'I', 'O', 'U'], method = this.httpMethodName(); | ||
static requestDescription(className) { | ||
const vowels = ['A', 'E', 'I', 'O', 'U'], method = HTTPRequest.httpMethodName(className); | ||
return `${~vowels.indexOf(method[0]) ? 'an' : 'a'} ${method} request`; | ||
@@ -85,0 +70,0 @@ } |
{ | ||
"name": "@serenity-js/rest", | ||
"version": "3.23.2", | ||
"version": "3.24.0", | ||
"description": "Test REST APIs with Serenity/JS", | ||
@@ -49,3 +49,3 @@ "author": { | ||
"dependencies": { | ||
"@serenity-js/core": "3.23.2", | ||
"@serenity-js/core": "3.24.0", | ||
"agent-base": "7.1.1", | ||
@@ -61,7 +61,7 @@ "axios": "1.7.2", | ||
"@integration/testing-tools": "3.0.0", | ||
"@serenity-js/assertions": "3.23.2", | ||
"@serenity-js/assertions": "3.24.0", | ||
"@types/chai": "4.3.16", | ||
"@types/mocha": "10.0.6", | ||
"axios-mock-adapter": "1.22.0", | ||
"c8": "9.1.0", | ||
"c8": "10.1.2", | ||
"mocha": "10.4.0", | ||
@@ -72,3 +72,3 @@ "mocha-multi": "1.1.7", | ||
}, | ||
"gitHead": "155af39040e128f5657ed3011bfa785d0af0b878" | ||
"gitHead": "174876f2ab2b96bce79ac825ba8c784beae2f63c" | ||
} |
@@ -14,4 +14,2 @@ import type { Answerable, AnswersQuestions, UsesAbilities, WithAnswerableProperties } from '@serenity-js/core'; | ||
private subject: string; | ||
/** | ||
@@ -33,4 +31,3 @@ * @param [resourceUri] | ||
) { | ||
super(); | ||
this.subject = `${ this.requestDescription() } to ${ d`${ this.resourceUri }` }`; | ||
super(`${ HTTPRequest.requestDescription(new.target.name) } to ${ d`${ resourceUri }` }`); | ||
} | ||
@@ -53,3 +50,3 @@ | ||
config, | ||
{ method: this.httpMethodName() }, | ||
{ method: HTTPRequest.httpMethodName(this.constructor.name) }, | ||
), | ||
@@ -69,22 +66,7 @@ ). | ||
/** | ||
* @inheritDoc | ||
*/ | ||
describedAs(subject: string): this { | ||
this.subject = subject; | ||
return this; | ||
} | ||
/** | ||
* @inheritDoc | ||
*/ | ||
toString(): string { | ||
return this.subject; | ||
} | ||
/** | ||
* Determines the request method based on the name of the request class. | ||
* For example: GetRequest => GET, PostRequest => POST, etc. | ||
*/ | ||
private httpMethodName(): string { | ||
return this.constructor.name.replace(/Request/, '').toUpperCase(); | ||
private static httpMethodName(className: string): string { | ||
return className.replace(/Request/, '').toUpperCase(); | ||
} | ||
@@ -95,6 +77,6 @@ | ||
*/ | ||
private requestDescription(): string { | ||
private static requestDescription(className: string): string { | ||
const | ||
vowels = [ 'A', 'E', 'I', 'O', 'U' ], | ||
method = this.httpMethodName(); | ||
method = HTTPRequest.httpMethodName(className); | ||
@@ -101,0 +83,0 @@ return `${ ~vowels.indexOf(method[0]) ? 'an' : 'a' } ${ method } request`; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
303359
5642
+ Added@serenity-js/core@3.24.0(transitive)
- Removed@serenity-js/core@3.23.2(transitive)
Updated@serenity-js/core@3.24.0