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


TypeScript assert.operator方法代码示例

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


在下文中一共展示了assert.operator方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: assertBBoxInclusion

export function assertBBoxInclusion(outerEl: d3Selection<Element>, innerEl: d3Selection<any>) {
  const outerBox = outerEl.node().getBoundingClientRect();
  const innerBox = innerEl.node().getBoundingClientRect();
  assert.operator(Math.floor(outerBox.left), "<=", Math.ceil(innerBox.left) + PIXEL_CLOSETO_REQUIREMENT,
          "bounding rect left included");
  assert.operator(Math.floor(outerBox.top), "<=", Math.ceil(innerBox.top) + PIXEL_CLOSETO_REQUIREMENT,
          "bounding rect top included");
  assert.operator(Math.ceil(outerBox.right) + PIXEL_CLOSETO_REQUIREMENT, ">=", Math.floor(innerBox.right),
          "bounding rect right included");
  assert.operator(Math.ceil(outerBox.bottom) + PIXEL_CLOSETO_REQUIREMENT, ">=", Math.floor(innerBox.bottom),
          "bounding rect bottom included");
}
开发者ID:palantir,项目名称:svg-typewriter,代码行数:12,代码来源:utils.ts

示例3: it

 it("two lines", () => {
   const text = "hello  world!.";
   const availableWidth = measurer.measure(text).width - 2;
   const baseWrapper = new Wrapper().maxLines(2);
   const result = wrapper.wrap(text, measurer, availableWidth);
   const baseResult = baseWrapper.wrap(text, measurer, availableWidth);
   const baseDimensions = measurer.measure(baseResult.wrappedText);
   const dimensions = measurer.measure(result.wrappedText);
   assert.deepEqual(result.originalText, text, "original text has been set");
   assert.notEqual(result.wrappedText, text, "wrapped text is not the whole line");
   assert.notEqual(result.wrappedText, baseResult.wrappedText, "wrapped text looks better");
   assert.operator(dimensions.width, "<", baseDimensions.width, "occupies less width");
   assert.equal(dimensions.height, baseDimensions.height, "occupies same height");
   assert.operator(dimensions.width, "<=", availableWidth, "wrapped text fits in");
 });
开发者ID:palantir,项目名称:svg-typewriter,代码行数:15,代码来源:wrapperTests.ts

示例4:

			return core.index.getIndex().then((index:tsd.DefIndex) => {
				assert.isTrue(index.hasIndex(), 'index.hasIndex');
				assert.operator(index.list.length, '>', 200, 'index.list');
				// xm.log(index.toDump());
				// TODO validate index data
				return null;
			});
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:7,代码来源:Core.ts

示例5:

			}).then((firstData:NodeBuffer) => {
				assert.instanceOf(firstData, Buffer, 'first callback data');
				assert.operator(firstData.length, '>', 0, 'first callback data');

				// get again, should be cached
				return repo.raw.getBinary(ref, filePath).progress((note:any) => {
					notes.push(note);
				}).then((secondData:NodeBuffer) => {
					assert.instanceOf(secondData, Buffer, 'second callback data');
					assert.strictEqual(firstData.toString('utf8'), secondData.toString('utf8'), 'first vs second data');

					repo.raw.track.complete('second');

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

示例6:

		helper.loadHeaderFixtures(path.resolve(__dirname, '..', 'fixtures', 'headers')).done((res:helper.HeaderAssert[]) => {
			assert.operator(res.length, '>', 0);
			data = res;
			if (filter) {
				data = data.filter((value:helper.HeaderAssert) => {
					return filter.indexOf(value.name) > -1;
				});
			}
			done();
		}, done);
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:10,代码来源:DefInfoParser.ts


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