Innovenergy_trunk/frontend/node_modules/testcafe/lib/assertions/get-fn.js

48 lines
9.5 KiB
JavaScript
Raw Normal View History

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const type_1 = __importDefault(require("./type"));
function getFn(command) {
switch (command.assertionType) {
case type_1.default.eql:
return () => chai_1.assert.deepEqual(command.actual, command.expected, command.message);
case type_1.default.notEql:
return () => chai_1.assert.notDeepEqual(command.actual, command.expected, command.message);
case type_1.default.ok:
return () => chai_1.assert.isOk(command.actual, command.message);
case type_1.default.notOk:
return () => chai_1.assert.isNotOk(command.actual, command.message);
case type_1.default.contains:
return () => chai_1.assert.include(command.actual, command.expected, command.message);
case type_1.default.notContains:
return () => chai_1.assert.notInclude(command.actual, command.expected, command.message);
case type_1.default.typeOf:
return () => chai_1.assert.typeOf(command.actual, command.expected, command.message);
case type_1.default.notTypeOf:
return () => chai_1.assert.notTypeOf(command.actual, command.expected, command.message);
case type_1.default.gt:
return () => chai_1.assert.isAbove(command.actual, command.expected, command.message);
case type_1.default.gte:
return () => chai_1.assert.isAtLeast(command.actual, command.expected, command.message);
case type_1.default.lt:
return () => chai_1.assert.isBelow(command.actual, command.expected, command.message);
case type_1.default.lte:
return () => chai_1.assert.isAtMost(command.actual, command.expected, command.message);
case type_1.default.within:
return () => (0, chai_1.expect)(command.actual).to.be.within(command.expected, command.expected2, command.message);
case type_1.default.notWithin:
return () => (0, chai_1.expect)(command.actual).not.to.be.within(command.expected, command.expected2, command.message);
case type_1.default.match:
return () => chai_1.assert.match(command.actual, command.expected, command.message);
case type_1.default.notMatch:
return () => chai_1.assert.notMatch(command.actual, command.expected, command.message);
default:
return () => void 0;
}
}
exports.default = getFn;
module.exports = exports.default;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LWZuLmpzIiwic291cmNlUm9vdCI6IiIsIn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