UNPKG

1.07 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const matcher_1 = require("./matcher");
4const stringification_1 = require("../stringification");
5class 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}
17exports.PropertyMatcher = PropertyMatcher;
18//# sourceMappingURL=property-matcher.js.map
\No newline at end of file