@serenity-js/assertions
Advanced tools
Comparing version 2.0.1-alpha.17 to 2.0.1-alpha.18
@@ -6,2 +6,18 @@ # Change Log | ||
## [2.0.1-alpha.18](https://github.com/jan-molak/serenity-js/compare/v2.0.1-alpha.17...v2.0.1-alpha.18) (2019-02-14) | ||
### Bug Fixes | ||
* **core:** `formatted` tag function correctly removes new line characters from the output ([41e9db3](https://github.com/jan-molak/serenity-js/commit/41e9db3)) | ||
### Features | ||
* **assertions:** Check.whether enables conditional flow ([abbac18](https://github.com/jan-molak/serenity-js/commit/abbac18)) | ||
## [2.0.1-alpha.17](https://github.com/jan-molak/serenity-js/compare/v2.0.1-alpha.16...v2.0.1-alpha.17) (2019-02-13) | ||
@@ -8,0 +24,0 @@ |
@@ -5,7 +5,7 @@ import { AnswersQuestions, Interaction, KnowableUnknown } from '@serenity-js/core'; | ||
private readonly actual; | ||
private readonly assertion; | ||
static that<A>(actual: KnowableUnknown<A>, assertion: Expectation<any, A>): Ensure<any>; | ||
constructor(actual: KnowableUnknown<Actual>, assertion: Expectation<Actual>); | ||
private readonly expectation; | ||
static that<A>(actual: KnowableUnknown<A>, expectation: Expectation<any, A>): Ensure<any>; | ||
constructor(actual: KnowableUnknown<Actual>, expectation: Expectation<Actual>); | ||
performAs(actor: AnswersQuestions): PromiseLike<void>; | ||
toString(): string; | ||
} |
@@ -12,8 +12,8 @@ "use strict"; | ||
var Ensure = /** @class */ (function () { | ||
function Ensure(actual, assertion) { | ||
function Ensure(actual, expectation) { | ||
this.actual = actual; | ||
this.assertion = assertion; | ||
this.expectation = expectation; | ||
} | ||
Ensure.that = function (actual, assertion) { | ||
return new Ensure(actual, assertion); | ||
Ensure.that = function (actual, expectation) { | ||
return new Ensure(actual, expectation); | ||
}; | ||
@@ -24,7 +24,7 @@ Ensure.prototype.performAs = function (actor) { | ||
actor.answer(this.actual), | ||
actor.answer(this.assertion), | ||
actor.answer(this.expectation), | ||
]). | ||
then(function (_a) { | ||
var actual = _a[0], assertion = _a[1]; | ||
return assertion(actual).then(function (outcome) { | ||
var actual = _a[0], expectation = _a[1]; | ||
return expectation(actual).then(function (outcome) { | ||
return tiny_types_1.match(outcome) | ||
@@ -39,3 +39,3 @@ .when(outcomes_1.ExpectationNotMet, function (o) { | ||
Ensure.prototype.toString = function () { | ||
return io_1.formatted(templateObject_2 || (templateObject_2 = __makeTemplateObject(["#actor ensures that ", " does ", ""], ["#actor ensures that ", " does ", ""])), this.actual, this.assertion); | ||
return io_1.formatted(templateObject_2 || (templateObject_2 = __makeTemplateObject(["#actor ensures that ", " does ", ""], ["#actor ensures that ", " does ", ""])), this.actual, this.expectation); | ||
}; | ||
@@ -42,0 +42,0 @@ return Ensure; |
@@ -0,1 +1,2 @@ | ||
export * from './Check'; | ||
export * from './Expectation'; | ||
@@ -2,0 +3,0 @@ export * from './expectations'; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./Check")); | ||
__export(require("./Expectation")); | ||
@@ -8,0 +9,0 @@ __export(require("./expectations")); |
{ | ||
"name": "@serenity-js/assertions", | ||
"version": "2.0.1-alpha.17", | ||
"version": "2.0.1-alpha.18", | ||
"description": "Screenplay-style assertion library", | ||
@@ -48,5 +48,5 @@ "author": { | ||
"devDependencies": { | ||
"@documentation/esdoc-template": "2.0.1-alpha.17", | ||
"@integration/testing-tools": "2.0.1-alpha.17", | ||
"@serenity-js/core": "2.0.1-alpha.17", | ||
"@documentation/esdoc-template": "2.0.1-alpha.18", | ||
"@integration/testing-tools": "2.0.1-alpha.18", | ||
"@serenity-js/core": "2.0.1-alpha.18", | ||
"tiny-types": "1.11.3" | ||
@@ -77,3 +77,3 @@ }, | ||
}, | ||
"gitHead": "71810ac6fd68746b8bc00c4e89a802edb86849d8" | ||
"gitHead": "820a431f9e2f3351a1d503381140043e72c8e416" | ||
} |
@@ -9,4 +9,4 @@ import { AnswersQuestions, AssertionError, Interaction, KnowableUnknown } from '@serenity-js/core'; | ||
export class Ensure<Actual> implements Interaction { | ||
static that<A>(actual: KnowableUnknown<A>, assertion: Expectation<any, A>) { | ||
return new Ensure(actual, assertion); | ||
static that<A>(actual: KnowableUnknown<A>, expectation: Expectation<any, A>) { | ||
return new Ensure(actual, expectation); | ||
} | ||
@@ -16,3 +16,3 @@ | ||
private readonly actual: KnowableUnknown<Actual>, | ||
private readonly assertion: Expectation<Actual>, | ||
private readonly expectation: Expectation<Actual>, | ||
) { | ||
@@ -24,6 +24,6 @@ } | ||
actor.answer(this.actual), | ||
actor.answer(this.assertion), | ||
actor.answer(this.expectation), | ||
]). | ||
then(([ actual, assertion ]) => | ||
assertion(actual).then(outcome => | ||
then(([ actual, expectation ]) => | ||
expectation(actual).then(outcome => | ||
match<Outcome<any, Actual>, void>(outcome) | ||
@@ -43,4 +43,4 @@ .when(ExpectationNotMet, o => { | ||
toString(): string { | ||
return formatted `#actor ensures that ${ this.actual } does ${ this.assertion }`; | ||
return formatted `#actor ensures that ${ this.actual } does ${ this.expectation }`; | ||
} | ||
} |
@@ -0,1 +1,2 @@ | ||
export * from './Check'; | ||
export * from './Expectation'; | ||
@@ -2,0 +3,0 @@ export * from './expectations'; |
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
67622
73
832