Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict"; // run code in ES5 strict mode
var expect = require("expect.js"),
$ = require("../testHelpers/jquery.js");
var proto = expect.Assertion.prototype,
be = proto.be,
eql = proto.eql,
a = proto.a,
contain = proto.contain,
empty = proto.empty;
// don't extend it when it's already extended
if (!expect.jQuery) {
expect.jQuery = true;
proto.be =
proto.equal = function (obj) {
this.obj = unwrap(this.obj);
obj = unwrap(obj);
be.call(this, obj);
};
var expect = require('expect.js');
var ao = expect.Assertion.prototype;
ao.typeEqual = function(list){
if(typeof list == 'string') list = list.split(',')
var types = this.obj.map(function(item){
return item.type
});
this.assert(
expect.eql(types, list)
, function(){ return 'expected ' + list + ' to equal ' + types }
, function(){ return 'expected ' + list + ' to not equal ' + types });
return this;
}
var Lexer = require("../../lib/parser/Lexer.js");
var config = require("../../lib/config.js");
var Regular = require("../../lib/index.js");
var types = this.obj.map(function(item){
return item.type
});
this.assert(
expect.eql(types, list)
, function(){ return 'expected ' + list + ' to equal ' + types }
, function(){ return 'expected ' + list + ' to not equal ' + types });
return this;
}
var Lexer = require("../../lib/parser/Lexer.js");
var config = require("../../lib/config.js");
var Regular = require("../../lib/index.js");
var ao = expect.Assertion.prototype;
/**
* setup template
*/
ao.typeEqual = function(list){
if(typeof list == 'string') list = list.split(',')
var types = this.obj.map(function(item){
return item.type
});
this.assert(
expect.eql(types, list)
, function(){ return 'expected ' + list + ' to equal ' + types }
, function(){ return 'expected ' + list + ' to not equal ' + types });
return this;
}
exports.LARGE_RAW_FILE = "test/resources/TheCompleteWorksOfShakespeare.mobi";
exports.LARGE_VIDEO = "test/resources/CloudBookStudy-HD.mp4";
exports.EMPTY_IMAGE = "test/resources/empty.gif";
exports.RAW_FILE = "test/resources/docx.docx";
exports.ICON_FILE = "test/resources/favicon.ico";
exports.IMAGE_URL = "http://res.cloudinary.com/demo/image/upload/sample";
exports.test_cloudinary_url = function (public_id, options, expected_url, expected_options) {
var url;
url = utils.url(public_id, options);
expect(url).to.eql(expected_url);
expect(options).to.eql(expected_options);
return url;
};
expect.Assertion.prototype.produceUrl = function (url) {
var actual, actualOptions, options, public_id;
[public_id, options] = this.obj;
actualOptions = cloneDeep(options);
actual = utils.url(public_id, actualOptions);
this.assert(actual.match(url), function () {
return `expected '${public_id}' and ${JSON.stringify(options)} to produce '${url}' but got '${actual}'`;
}, function () {
return `expected '${public_id}' and ${JSON.stringify(options)} not to produce '${url}' but got '${actual}'`;
});
return this;
};
expect.Assertion.prototype.emptyOptions = function () {
var actual, options, public_id;
[public_id, options] = this.obj;
actual = cloneDeep(options);
)
);
};
/**
* A `expect` test matcher that is used to check if a promise was resolved or not.
*
* This matcher only exists because just returning a promise from a test that contains no `expect`
* calls looks a bit lame, but in reality this matcher wouldn’t need to exist, as a test will
* automatically fail if a returned promise fails. This is also why there’s no `resolvedWith`
* matcher, because in that case the `resolve` callback of the promise would contain an `expect`
* call.
*
* @returns {Promise}
*/
expect.Assertion.prototype.resolved = function resolved() {
this.flags.not = !this.flags.not;
return this.rejected();
};
/**
* Copyright (c) 2015, Yanis Wang
* Copyright (c) 2015, YangJiyuan
* MIT Licensed
*/
var expect = require("expect.js");
var HTMLParser = require("../index").HTMLParser;
expect.Assertion.prototype.event = function(type, attr){
var self = this,
obj = self.obj;
if(attr !== undefined){
attr.type = type;
}
else{
attr = {'type': type};
}
self.assert(
eqlEvent(obj, attr),
function(){ return 'expected "'+JSON.stringify(obj)+'" to event "'+JSON.stringify(attr)+'"'; },
function(){ return 'expected "'+JSON.stringify(obj)+'" not to event "'+JSON.stringify(attr)+'"'; });
};
function eqlEvent(event, attr){
for(var name in attr){
var expect = require('expect.js');
/**
* Adapted from Tobi to work with expect.js
*
* Tobi - assertions - should
* Copyright(c) 2010 LearnBoost
* MIT Licensed
*/
var Assertion = expect.Assertion
, statusCodes = require('http').STATUS_CODES
, j = function(elem){ return '[jQuery ' + i(elem.selector.replace(/^ *\* */, '')) + ']'; }
, i = require('sys').inspect;
/**
* Number strings.
*/
var nums = [
'none'
, 'one'
, 'two'
, 'three'
, 'four'
, 'five'
];
const expect = require('expect.js');
const HTMLParser = require('../dist/htmlhint.js').HTMLParser;
expect.Assertion.prototype.event = function(type, attr) {
const self = this;
const obj = self.obj;
if (attr !== undefined) {
attr.type = type;
} else {
if (typeof attr === 'string') {
attr = { type: type };
} else {
attr = type;
}
}
self.assert(
eqlEvent(obj, attr),
() =>
`expected "${JSON.stringify(obj)}" to event "${JSON.stringify(attr)}"`,
function registerAssertions() {
expect.Assertion.prototype.withState = withState;
expect.Assertion.prototype.dispatchActions = dispatchActions;
}
function registerAssertions() {
expect.Assertion.prototype.withState = withState;
expect.Assertion.prototype.dispatchActions = dispatchActions;
}