Innovenergy_trunk/frontend/node_modules/testcafe/lib/api/test-controller/assertion.js

107 lines
21 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const assertion_1 = require("../../test-run/commands/assertion");
const test_run_1 = require("../../errors/test-run");
const types_1 = require("../../client-functions/types");
const add_rendered_warning_1 = __importDefault(require("../../notifications/add-rendered-warning"));
const warning_message_1 = __importDefault(require("../../notifications/warning-message"));
class Assertion {
constructor(actual, testController, callsite) {
this._testController = testController;
this._actual = actual;
this._callsite = callsite;
}
then() {
throw new test_run_1.AssertionWithoutMethodCallError(this._callsite);
}
_enqueueAssertion(command, assertionArgs) {
let options = assertionArgs.opts || {};
let message = assertionArgs.message;
// NOTE: Assertion options should be specified after the 'message' parameter.
// await t.expect(42).eql(43, 'wrong value', { timeout: 10000 });
// In case of empty assertion message we allowing to specify assertion option in place of assertion message.
// await t.expect(42).eql(43, { timeout: 10000 });
if (typeof message === 'object') {
options = assertionArgs.message;
message = void 0;
}
return this._testController.enqueueCommand(command, {
assertionType: command.methodName,
actual: this._actual,
expected: assertionArgs.expected,
expected2: assertionArgs.expected2,
message: message,
options: { timeout: options.timeout, allowUnawaitedPromise: options.allowUnawaitedPromise },
}, this._checkForWarnings.bind(this));
}
_checkForWarnings(testController, assertionCommand, callsite) {
testController.checkForExcessiveAwaits(callsite, assertionCommand);
if ((0, types_1.isClientFunction)(assertionCommand.actual)) {
(0, add_rendered_warning_1.default)(testController.warningLog, {
message: warning_message_1.default.assertedClientFunctionInstance,
actionId: assertionCommand.actionId,
}, callsite);
}
else if ((0, types_1.isSelector)(assertionCommand.actual)) {
(0, add_rendered_warning_1.default)(testController.warningLog, {
message: warning_message_1.default.assertedSelectorInstance,
actionId: assertionCommand.actionId,
}, callsite);
}
}
[assertion_1.EqlAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.EqlAssertionCommand, { expected, message, opts });
}
[assertion_1.NotEqlAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.NotEqlAssertionCommand, { expected, message, opts });
}
[assertion_1.OkAssertionCommand.methodName](message, opts) {
return this._enqueueAssertion(assertion_1.OkAssertionCommand, { message, opts });
}
[assertion_1.NotOkAssertionCommand.methodName](message, opts) {
return this._enqueueAssertion(assertion_1.NotOkAssertionCommand, { message, opts });
}
[assertion_1.ContainsAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.ContainsAssertionCommand, { expected, message, opts });
}
[assertion_1.NotContainsAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.NotContainsAssertionCommand, { expected, message, opts });
}
[assertion_1.TypeOfAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.TypeOfAssertionCommand, { expected, message, opts });
}
[assertion_1.NotTypeOfAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.NotTypeOfAssertionCommand, { expected, message, opts });
}
[assertion_1.GtAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.GtAssertionCommand, { expected, message, opts });
}
[assertion_1.GteAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.GteAssertionCommand, { expected, message, opts });
}
[assertion_1.LtAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.LtAssertionCommand, { expected, message, opts });
}
[assertion_1.LteAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.LteAssertionCommand, { expected, message, opts });
}
[assertion_1.WithinAssertionCommand.methodName](start, finish, message, opts) {
// NOTE: `within` is not available in Chai `assert` interface.
return this._enqueueAssertion(assertion_1.WithinAssertionCommand, { expected: start, expected2: finish, message, opts });
}
[assertion_1.NotWithinAssertionCommand.methodName](start, finish, message, opts) {
return this._enqueueAssertion(assertion_1.NotWithinAssertionCommand, { expected: start, expected2: finish, message, opts });
}
[assertion_1.MatchAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.MatchAssertionCommand, { expected, message, opts });
}
[assertion_1.NotMatchAssertionCommand.methodName](expected, message, opts) {
return this._enqueueAssertion(assertion_1.NotMatchAssertionCommand, { expected, message, opts });
}
}
exports.default = Assertion;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL2FwaS90ZXN0LWNvbnRyb2xsZXIvYXNzZXJ0aW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsaUVBa0IyQztBQUMzQyxvREFBd0U7QUFJeEUsd0RBQTRFO0FBQzVFLG9HQUFrRTtBQUNsRSwwRkFBa0U7QUFTbEUsTUFBcUIsU0FBUztJQUsxQixZQUFvQixNQUFlLEVBQUUsY0FBOEIsRUFBRSxRQUF3QjtRQUN6RixJQUFJLENBQUMsZUFBZSxHQUFHLGNBQWMsQ0FBQztRQUN0QyxJQUFJLENBQUMsT0FBTyxHQUFXLE1BQU0sQ0FBQztRQUM5QixJQUFJLENBQUMsU0FBUyxHQUFTLFFBQVEsQ0FBQztJQUNwQyxDQUFDO0lBRU0sSUFBSTtRQUNQLE1BQU0sSUFBSSwwQ0FBK0IsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDOUQsQ0FBQztJQUVPLGlCQUFpQixDQUFFLE9BQWdDLEVBQUUsYUFBNEI7UUFDckYsSUFBSSxPQUFPLEdBQUcsYUFBYSxDQUFDLElBQUksSUFBSSxFQUFFLENBQUM7UUFDdkMsSUFBSSxPQUFPLEdBQUcsYUFBYSxDQUFDLE9BQU8sQ0FBQztRQUVwQyw2RUFBNkU7UUFDN0UsaUVBQWlFO1FBQ2pFLDRHQUE0RztRQUM1RyxrREFBa0Q7UUFDbEQsSUFBSSxPQUFP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