UNPKG

alsatian-fluent-assertions

Version:

Fluent assertions extension to Alsatian xUnit framework.

42 lines 1.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fluent_matcher_base_1 = require("./fluent-matcher-base"); class Operators extends fluent_matcher_base_1.FluentMatcherBase { constructor(actualValue, nextValue, initial, prevCore, ctxt) { super(actualValue, nextValue, initial, prevCore, ctxt); } get not() { this.setCurrentNode("not", null); return this.generateFluentState(this.actualValue, this.nextValue, !this.invert, this.hasNext); } maybe(verbatim) { this.setCurrentNode(this.maybe.name, `${verbatim}`); // invert = !verbatim return this.generateFluentState(this.actualValue, this.nextValue, this.invert === verbatim, this.hasNext); /** * invert | verbatim | result (invert) * false | false | true * false | true | false * true | false | false * true | true | true */ } get lastContextualValue() { return this.actualValue; } get kThx() { return this.prevCore; } get that() { this.setCurrentNode("that", null); if (!this.hasNext) { throw new Error("Fluent scope cannot narrow when narrowable value not defined by previous assertions."); } return this.generateFluentState(this.nextValue, null, false, false, this.parent); } forReason(reason, data) { return this.generateFluentState(this.actualValue, this.nextValue, this.invert, this.hasNext, null, reason, data); } } exports.Operators = Operators; //# sourceMappingURL=operators.js.map