当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript assert.jsonOf方法代码示例

本文整理汇总了TypeScript中chai.assert.jsonOf方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.jsonOf方法的具体用法?TypeScript assert.jsonOf怎么用?TypeScript assert.jsonOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chai.assert的用法示例。


在下文中一共展示了assert.jsonOf方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: assertCLIResult

	function assertCLIResult(result:xm.RunCLIResult, test, info:helper.TestInfo, args):void {
		assert.isObject(result, 'result');
		assert.strictEqual(result.code, 0, 'result.code');
		assert.operator(result.stdout.length, '>=', 0, 'result.stdout.length');

		var stdout = trimHeader(result.stdout.toString('utf8'));
		var stderr = trimHeader(result.stderr.toString('utf8'));

		fs.writeFileSync(info.stdoutFile, stdout, 'utf8');
		if (result.stderr.length > 0) {
			fs.writeFileSync(info.stderrFile, stderr, 'utf8');
		}
		if (result.error) {
			xm.file.writeJSONSync(info.errorFile, result.error);
		}

		var stdoutExpect = fs.readFileSync(info.stdoutExpect, 'utf8');
		assert.operator(stdoutExpect.length, '>=', 0, 'stdoutExpect.length');

		helper.longAssert(stdout, stdoutExpect, 'result.stdout');

		if (fs.existsSync(info.stderrExpect)) {
			var stderrExpect = fs.readFileSync(info.stderrExpect, 'utf8');
			helper.longAssert(stderr, stderrExpect, 'result.stderr');
		}
		if (fs.existsSync(info.errorExpect)) {
			var errorExpect = xm.file.readJSONSync(info.errorExpect);
			assert.jsonOf(result.error, errorExpect, 'result.error');
		}
	}
开发者ID:HansS,项目名称:tsd,代码行数:30,代码来源:CLI.ts

示例2: 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');
		}
	}
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:15,代码来源:Selection.ts

示例3: fixMeta

			}).then((first) => {
				assert.ok(first, 'first data');
				assert.isObject(first, 'first data');
				assert.strictEqual(first.sha, expectedSha, 'first.sha vs expectedSha');

				assert.jsonSchema(first, metaFields, 'first meta');
				fixMeta(first.meta);
				assert.jsonOf(expectedJson, first, 'first vs expectedJson');

				var firstBuffer = git.GitUtil.decodeBlobJson(first);
				assert.instanceOf(firstBuffer, Buffer, 'buffer');

				var firstSha = git.GitUtil.blobShaHex(firstBuffer);
				assert.strictEqual(firstSha, expectedSha, 'firstSha vs expected');

				// get again, should be cached
				return repo.api.getBlob(expectedSha).progress((note:any) => {
					notes.push(note);
				}).then((second) => {
					assert.ok(second, 'second data');
					assert.isObject(second, 'second data');
					assert.strictEqual(second.sha, expectedSha, 'second.sha vs expectedSha');

					var secondBuffer = git.GitUtil.decodeBlobJson(first);
					assert.instanceOf(secondBuffer, Buffer, 'buffer');
					var secondSha = git.GitUtil.blobShaHex(secondBuffer);
					assert.strictEqual(secondSha, expectedSha, 'secondSha vs expected');

					helper.assertNotes(notes, [
						{
							message: /^remote: /,
							code: 'http 200'
						},
						{
							message: /^local: /,
							code: null
						}
					], 'second');
				});
			});
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:40,代码来源:GithubAPI.ts


注:本文中的chai.assert.jsonOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。