本文整理汇总了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');
}
}
示例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");
}
示例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");
});
示例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;
});
示例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');
});
});
示例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);