本文整理汇总了TypeScript中chai.assert.isFunction方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isFunction方法的具体用法?TypeScript assert.isFunction怎么用?TypeScript assert.isFunction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.isFunction方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
export function assertMap<V>(map:Map<string, V>, values:any, assertion:AssertCB<V>, message:string):void {
assert.isObject(map, message + ': map');
assert.isObject(values, message + ': values');
assert.isFunction(assertion, message + ': assertion');
var mapKeys:string[] = xm.keysOf(map).sort();
var valueKeys:string[] = Object.keys(values).sort();
assert.sameMembers(mapKeys, valueKeys, message + ': same paths');
var keys:string[] = mapKeys.slice(0);
valueKeys.forEach((key:string) => {
var i = keys.indexOf(key);
assert(i > -1, message + ': expected key "' + key + '"');
keys.splice(i, 1);
assert(map.has(key), message + ': missing key "' + key + '"');
assertion(map.get(key), values[key], message + ': key "' + key + '"');
});
assert(keys.length === 0, message + ': unexpected keys remaining: ' + keys + '');
}
示例2: while
export function assertUnorderedNaive<T>(actual:T[], expected:T[], assertion:AssertCB<T>, message:string):void {
assert.isArray(actual, 'actual');
assert.isArray(expected, 'expected');
assert.isFunction(assertion, 'assertion');
assert.strictEqual(actual.length, expected.length, message + ': length not equal: ' + actual.length + ' != ' + expected.length);
// clones
var actualQueue = actual.slice(0);
var expectedQueue = expected.slice(0);
outer : while (actualQueue.length > 0) {
var act = actualQueue.pop();
for (var i = 0, ii = expectedQueue.length; i < ii; i++) {
var exp = expectedQueue[i];
// try every assertion
try {
assertion(act, exp, message);
// passed, remove it
expectedQueue.splice(i, 1);
// jump
continue outer;
}
catch (err) {
// maybe next one
}
}
assert(false, message + ': no matching element for actual: ' + xm.toValueStrim(act));
}
// also bad
if (expectedQueue.length > 0) {
// use assert.deepEqual for diff report
assert.deepEqual([], expectedQueue, message + ': remaining expect elements: ' + expectedQueue.length);
}
}
示例3: it
it('is defined', () => {
assert.isFunction(tsd.Def, 'Def');
});
示例4: it
it('is constructor', () => {
assert.isFunction(xm.JSONStabilizer);
});
示例5: it
it('should be defined', () => {
assert.isFunction(git.GithubURLs, 'GithubURLs.constructor');
});
示例6: it
it('is constructor', () => {
assert.isFunction(xm.JSONPointer);
});
示例7: it
it('should exist', () => {
assert.isFunction(xm.http.HTTPCache, 'cache');
assert.isFunction(xm.http.CacheOpts, 'opts');
assert.isFunction(xm.http.CacheObject, 'object');
assert.isFunction(xm.http.CacheRequest, 'request');
});
示例8: it
it('should be defined', () => {
assert.isFunction(xm.URLManager, 'constructor');
});
示例9: it
it('returns a function if only one argument provided', function () {
assert.isFunction(isStrictEqual(1));
});
示例10: it
it('should be defined', () => {
assert.isFunction(tsd.Core, 'constructor');
});