本文整理汇总了TypeScript中chai.assert.isAtMost方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.isAtMost方法的具体用法?TypeScript assert.isAtMost怎么用?TypeScript assert.isAtMost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.isAtMost方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onRuntimeSendMessageCalled
aFromRuntime.sendMessage.callsFake((aMessage) => {
const {_listeners} = aToRuntime.onMessage;
assert.isAtMost(_listeners.length, 1);
if (_listeners.length === 0) return Promise.resolve();
const rv = Promise.resolve(_listeners[0](aMessage));
if (onRuntimeSendMessageCalled) {
onRuntimeSendMessageCalled(aMessage, rv);
}
return rv;
});
开发者ID:RequestPolicyContinued,项目名称:requestpolicy,代码行数:10,代码来源:test-storage-migration-between-xpcom-and-we.ts
示例2: filteredCustomers1
@test('filter="fre" returns subset of results')
public async filteredCustomers1() {
let result = await getAllCustomers({ filter: 'fre' });
assert.isArray(result, 'Expected result to be an array');
assert.isAtLeast(result.length, 3, 'Expected 3 or more customers in array');
assert.isAtMost(result.length, 5, 'Expected 5 or fewer customers in array');
validateRecordColumns(
{
recordType: 'customer',
functionName: 'getAllCustomers({ filter: "fre" })'
},
result[0],
ALL_CUSTOMERS_REQUIRED_COLS,
[]
);
}
示例3:
fetchMock.mock("/ts/query", "post", (url: string, requestObj: RequestInit) => {
// Assert that metric store's "inFlight" is 1 or 2.
assert.isAtLeast(mockMetricsState.inFlight, 1);
assert.isAtMost(mockMetricsState.inFlight, 1);
let request = JSON.parse(requestObj.body as string) as TSRequest;
return {
body: {
results: _.map(request.queries, (q) => {
return {
query: q,
datapoints: [],
};
}),
},
};
});
示例4:
response: (url: string, requestObj: RequestInit) => {
// Assert that metric store's "inFlight" is 1 or 2.
assert.isAtLeast(mockMetricsState.inFlight, 1);
assert.isAtMost(mockMetricsState.inFlight, 2);
let request = protos.cockroach.ts.tspb.TimeSeriesQueryRequest.decode(requestObj.body as ArrayBuffer);
return {
body: new protos.cockroach.ts.tspb.TimeSeriesQueryResponse({
results: _.map(request.queries, (q) => {
return {
query: q,
datapoints: [],
};
}),
}).toArrayBuffer(),
};
},
示例5:
fetchMock.mock("/ts/query", "post", (url: string, requestObj: RequestInit) => {
// Assert that metric store's "inFlight" is 1 or 2.
assert.isAtLeast(mockMetricsState.inFlight, 1);
assert.isAtMost(mockMetricsState.inFlight, 1);
let request = new protos.cockroach.ts.tspb.TimeSeriesQueryRequest(JSON.parse(requestObj.body as string));
return {
sendAsJson: false,
body: new protos.cockroach.ts.tspb.TimeSeriesQueryResponse({
results: _.map(request.queries, (q) => {
return {
query: q,
datapoints: [],
};
}),
}).encodeJSON(),
};
});
示例6: filteredCustomers2
@test('filter="mo" returns subset of results')
public async filteredCustomers2() {
let result = await getAllCustomers({ filter: 'mo' });
assert.isArray(result, 'Expected result to be an array');
assert.isAtMost(
result.length,
12,
'Expected 12 or fewer customers in array'
);
validateRecordColumns(
{
recordType: 'customer',
functionName: 'getAllCustomers({ filter: "mo" })'
},
result[1],
ALL_CUSTOMERS_REQUIRED_COLS,
[]
);
}