1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const matcher_1 = require("./matcher");
|
4 | const stringification_1 = require("../stringification");
|
5 | class PropertyMatcher extends matcher_1.Matcher {
|
6 | toHaveBeenSet() {
|
7 | this._registerMatcher((this.actualValue.setCalls.length === 0) !== this.shouldMatch, `Expected property ${!this.shouldMatch ? "not " : ""}to be set`, `property ${this.shouldMatch ? "" : "not "}to have been set`);
|
8 | }
|
9 | toHaveBeenSetTo(value) {
|
10 | const stringifiedValue = stringification_1.stringify(value);
|
11 | this._registerMatcher(this.actualValue.setCalls.some(call => call.args[0] === value) === this.shouldMatch, `Expected property ${!this.shouldMatch ? "not " : ""}to be set to ${stringifiedValue}.`, `property ${this.shouldMatch ? "" : "not "}to be set to ${stringifiedValue}.`, {
|
12 | actualValues: this.actualValue.setCalls.map(call => call.args[0]),
|
13 | expectedValue: value
|
14 | });
|
15 | }
|
16 | }
|
17 | exports.PropertyMatcher = PropertyMatcher;
|
18 |
|
\ | No newline at end of file |