本文整理汇总了TypeScript中chai.assert.isBelow方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isBelow方法的具体用法?TypeScript assert.isBelow怎么用?TypeScript assert.isBelow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.isBelow方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: done
.then((table: DataTable[]) => {
let row = table[0].rows[0];
// assert.equal(row["guid"], testGuid);
assert.equal(row["str250"], testStr250);
assert.equal(row["text"], testText);
assert.equal(row["sbyte"], testSByte);
assert.equal(row["byte"], testByte);
assert.equal(row["short"], testShort);
assert.equal(row["int"], testInt);
assert.equal(row["uint"], testUInt);
assert.equal(row["long"], testLong);
assert.equal(row["ulong"], testULong);
assert.isBelow(Math.abs(row["float"] - testFloat), 1e+33);
assert.equal(row["decimal"], testDecimal);
assert.equal(row["date"].getTime(), testDate.getTime());
assert.equal(row["datetime"].getTime(), testDateTime.getTime());
//console.log({fromDb1: row["double"], test: testDouble, sub: row["double"] - testDouble});
assert.isBelow(Math.abs(row["double"] - testDouble), 5e+293);
done();
})
示例2: it
it("arrayLengthCompare", () => {
assert.isAbove(Utils.arrayLengthCompare([1, 2], []), 0);
assert.strictEqual(Utils.arrayLengthCompare([1, 2], [1, 2]), 0);
assert.isBelow(Utils.arrayLengthCompare([], [1, 2]), 0);
assert.isAbove(Utils.arrayLengthCompare([1]), 0);
assert.strictEqual(Utils.arrayLengthCompare(), 0);
assert.isBelow(Utils.arrayLengthCompare(undefined, [1]), 0);
});
示例3: comparatorFactory
'if the first ranker does not produce a tie', () => {
const specM1 = SpecQueryModel.build(
{
mark: Mark.POINT,
encodings: [
{channel: Channel.X, field: 'Q', type: Type.QUANTITATIVE},
{channel: Channel.Y, field: 'Q1', type: Type.QUANTITATIVE},
]
},
schema,
DEFAULT_QUERY_CONFIG
);
const specM2 = SpecQueryModel.build(
{
mark: Mark.POINT,
encodings: [
{aggregate: 'mean', channel: Channel.X, field: 'Q', type: Type.QUANTITATIVE},
{aggregate: 'mean', channel: Channel.Y, field: 'Q1', type: Type.QUANTITATIVE},
]
},
schema,
DEFAULT_QUERY_CONFIG
);
const comparator = comparatorFactory(['aggregationQuality', 'effectiveness'], schema, DEFAULT_QUERY_CONFIG);
assert.isBelow(comparator(specM1, specM2), 0);
});
示例4: it
it('should create a comparator that correctly sorts two spec when passed an orderBy string of aggregationQuality', () => {
const specM1 = SpecQueryModel.build(
{
mark: Mark.POINT,
encodings: [
{channel: Channel.X, field: 'Q', type: Type.QUANTITATIVE},
{channel: Channel.Y, field: 'Q1', type: Type.QUANTITATIVE},
]
},
schema,
DEFAULT_QUERY_CONFIG
);
const specM2 = SpecQueryModel.build(
{
mark: Mark.POINT,
encodings: [
{aggregate: 'mean', channel: Channel.X, field: 'Q', type: Type.QUANTITATIVE},
{aggregate: 'mean', channel: Channel.Y, field: 'Q1', type: Type.QUANTITATIVE},
]
},
schema,
DEFAULT_QUERY_CONFIG
);
const comparator = comparatorFactory('aggregationQuality', schema, DEFAULT_QUERY_CONFIG);
assert.isBelow(comparator(specM1, specM2), 0);
});
示例5: infiniteCounter
function* infiniteCounter() {
let c = 0;
while (true) {
assert.isBelow(c, 6, 'Iterated more than 5 times.');
yield c++;
}
}
示例6:
return safe.nfs.getDir(client, { dirPath: topLevelPath, isPathShared: scenario.shared }).then(resp => {
assert.lengthOf(resp.subDirectories, 0)
assert.lengthOf(resp.files, 1)
assert.equal(resp.files[0].name, fileName)
assert.equal(resp.files[0].size, 0)
// Is in the past 20 seconds?
assert.isBelow(resp.files[0].createdOn, Date.now())
assert.isAbove(resp.files[0].createdOn, Date.now() - (20 * 1000))
})
示例7: sweetHotFilter
@test('getAllProducts with flavor filter: sweet>2 spicy>2')
public async sweetHotFilter() {
await updateProduct(1, {
metadata: {
flavor: { sweet: 5, sour: 5, bitter: 5, salty: 5, spicy: 5 }
},
tags: []
});
let allResults = await getAllProducts();
let sweetHotResults = await getAllProducts({
filter: {
flavor: [
{ flavorName: 'spicy', type: 'greater-than', level: 2 },
{ flavorName: 'sweet', type: 'greater-than', level: 2 }
]
}
});
assert.isAbove(
sweetHotResults.length,
0,
'Nonzezro number of sweetHotResults'
);
assert.isBelow(
sweetHotResults.length,
allResults.length,
'Sweet-hot products are a subset of all products'
);
assert.ok(
sweetHotResults.every(
p =>
p.metadata &&
p.metadata.flavor &&
p.metadata.flavor.sweet > 2 &&
p.metadata.flavor.spicy > 2
),
'All results from sweet-hot filter have sweet > 2 and spicy > 2'
);
assert.ok(
differenceWith(
allResults,
sweetHotResults,
(a: any, b: any) => a.id === b.id
).every(
p =>
!p.metadata ||
p.metadata.flavor.sweet <= 2 ||
p.metadata.flavor.spicy <= 2
),
'All results excluded by sweet-hot filter have sweet <= 2 OR spicy <= 2'
);
}
示例8: sweetSourFilter
@test('getAllProducts with flavor filter: sweet>2 sour>2')
public async sweetSourFilter() {
let allResults = await getAllProducts();
let sweetSourResults = await getAllProducts({
filter: {
flavor: [
{ flavorName: 'sour', type: 'greater-than', level: 2 },
{ flavorName: 'sweet', type: 'greater-than', level: 2 }
]
}
});
assert.isBelow(
sweetSourResults.length,
allResults.length,
'Sweet-sour products are a subset of all products'
);
assert.ok(
sweetSourResults.every(
p =>
p &&
p.metadata &&
p.metadata.flavor &&
p.metadata.flavor.sweet > 2 &&
p.metadata.flavor.sour > 2
),
'All results from sweet-sour filter have sweet > 2 and sour > 2'
);
assert.ok(
differenceWith(
allResults,
sweetSourResults,
(a: any, b: any) => a.id === b.id
).every(
p =>
!p ||
!p.metadata ||
!p.metadata.flavor ||
(p.metadata.flavor.sweet <= 2 || p.metadata.flavor.sour <= 2)
),
'All results excluded by sweet-sour filter have sweet <= 2 OR sour <= 2'
);
}