本文整理汇总了TypeScript中chai.assert.isObject方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isObject方法的具体用法?TypeScript assert.isObject怎么用?TypeScript assert.isObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.isObject方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('exports packageInfo', () => {
assert.isObject(ctx.packageInfo, 'packageInfo');
assert.instanceOf(ctx.packageInfo, xm.PackageJSON, 'config');
assert.isString(ctx.packageInfo.name, 'name');
assert.isString(ctx.packageInfo.version, 'version');
assert.isObject(ctx.packageInfo.raw, 'pkg');
});
示例2: test
test("then the products should be there", () => {
assert.isArray(customer.shoppingCart.items);
assert.equal(customer.shoppingCart.items.length, 2);
const item1 = _(customer.shoppingCart.items).find((item: any) => item.id === "redoma-2006-0.75");
assert.isObject(item1);
assert.equal(item1.quantity, 3);
const item2 = _(customer.shoppingCart.items).find((item: any) => item.id === "tiara-2014-1.5");
assert.isObject(item2);
assert.equal(item2.quantity, 2);
});
示例3: assertStatCounter
export function assertStatCounter(stat:xm.StatCounter, values:any, message:string) {
assert.isObject(stat, message + ': stat');
assert.isObject(values, message + ': values');
assert.instanceOf(stat, xm.StatCounter, message + ': stat');
var obj = {};
// only check required values? hmm...
Object.keys(values).forEach((key:string) => {
// if (stat.has(key)) {
obj[key] = stat.get(key);
//}
});
assert.deepEqual(obj, values, message + ': stat');
}
示例4: getArgs
function getArgs(test, data, info:helper.TestInfo):string[] {
assert.isObject(test, 'test');
assert.isObject(data, 'data');
assert.instanceOf(info, helper.TestInfo, 'info');
var args:string[] = [];
if (test.command) {
assert.isArray(test.command, 'test.command');
args.push.apply(args, test.command);
}
else if (data.command) {
assert.isArray(data.command, 'data.command');
args.push.apply(args, data.command);
}
if (test.query) {
if (test.query.pattern) {
args.push(test.query.pattern);
}
if (test.query.overwrite) {
args.push('--overwrite');
}
if (test.query.resolve) {
args.push('--resolve');
}
if (test.query.save) {
args.push('--save');
}
}
if (test.style) {
args.push('--style', test.style);
}
else {
args.push('--style', 'plain');
}
args.push('--progress', 'no');
args.push('--services', 'no');
args.push('--cacheMode', xm.http.CacheMode[helper.settings.cache]);
args.push('--cacheDir', info.cacheDirTestFixed);
args.push('--config', path.resolve('./test/fixtures/config/default.json'));
// TODO also write a .bat/.cmd and a shell script; with absolute paths etc (for lazy re-run)
xm.file.writeJSONSync(info.argsDump, {list: args, flat: args.join(' ')});
return args;
}
示例5: assertObjectValues
export function assertObjectValues(actual:Object, expected:Object, msg?:string):void {
assert.isObject(actual, msg + ': actual');
assert.isObject(expected, msg + ': expected');
var test:any = {};
Object.keys(expected).forEach((prop:string) => {
if (typeof actual[prop] !== 'undefined') {
test[prop] = actual[prop];
}
else {
test[prop] = 0;
}
});
assert.deepEqual(test, expected, msg);
}
示例6: assertSelection
export function assertSelection(selection:tsd.Selection, values:any, message:string) {
assert.isObject(selection, message + ': selection');
assert.isObject(values, message + ': values');
assert.instanceOf(selection, tsd.Selection, message + ': selection');
if (values.selection) {
helper.assertDefVersionArray(selection.selection, values.selection, message + ': selection');
}
if (values.definitions) {
helper.assertDefArray(selection.definitions, values.definitions, message + ': definitions');
}
if (values.error) {
assert.jsonOf(values.error, selection.error, message + ': error');
}
}
示例7: assertInstallResult
export function assertInstallResult(result:tsd.InstallResult, values:any, message:string) {
assert.isObject(result, message + ': result');
assert.isObject(values, message + ': values');
assert.instanceOf(result, tsd.InstallResult, message + ': result');
if (values.written) {
helper.assertMap(result.written, values.written, helper.assertDefVersionFlat, message + ': written');
}
if (values.removed) {
helper.assertMap(result.removed, values.removed, helper.assertDefVersionFlat, message + ': removed');
}
if (values.skipped) {
helper.assertMap(result.skipped, values.skipped, helper.assertDefVersionFlat, message + ': skipped');
}
}
示例8: it
it('should attempt to sync files', () => {
mockWatchmanClient.on = sinon.stub().callsArgWith(1, {subscription: 'example1'});
const watchman = new Watchman(config, watchmanClient, terminal, sync);
watchman.start();
chai.assert.isObject(watchman, 'watchman is an object');
});
示例9: it
it("displays when cluster health endpoint returns an error", function () {
dispatch(healthReducerObj.errorData(new Error("error")));
const alert = disconnectedAlertSelector(state());
assert.isObject(alert);
assert.equal(alert.level, AlertLevel.CRITICAL);
assert.equal(alert.title, "We're currently having some trouble fetching updated data. If this persists, it might be a good idea to check your network connection to the CockroachDB cluster.");
});
示例10: isBaseError
export function isBaseError(error: any, baseErrorType: IBaseErrorType): void {
chai.assert.isObject(error);
chai.assert.instanceOf(error, BaseError);
chai.assert.equal(error.errno, baseErrorType.errno);
chai.assert.equal(error.message, baseErrorType.message);
}