本文整理汇总了TypeScript中chai.assert.oneOf方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.oneOf方法的具体用法?TypeScript assert.oneOf怎么用?TypeScript assert.oneOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.oneOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('prompts with a list of all registered generators', async () => {
const promptStub = sinon.stub(inquirer, 'prompt')
.returns(Promise.resolve({foo: 'TEST'}));
try {
await polymerInit.promptGeneratorSelection({env: yeomanEnvMock});
} catch (error) {
assert.equal(error.message, 'Template TEST not found');
}
const choices =
(promptStub.firstCall.args[0] as inquirer.Question[])[0].choices as
inquirer.objects.ChoiceOption[];
assert.equal(choices.length, GENERATORS.length);
for (const choice of choices) {
const generator = GENERATORS.find(
(generator) => generator.generatorName === choice.value)!;
assert.isDefined(generator, `generator not found: ${choice.value}`);
assert.oneOf(stripAnsi(choice.name!), [
generator.shortName,
`${generator.shortName} - ${generator.description}`,
]);
assert.equal(choice.value, generator.generatorName);
// tslint:disable-next-line: no-any
assert.equal((choice as any).short, generator.shortName);
}
});
示例2: assertPoint
response.forEach((data) => {
assertPoint(data);
assert.include(data.name, "Frauenkirche");
assert.strictEqual(data.city, "Dresden");
assert.isString(data.id);
assertCoords(data.coords);
assert.oneOf(data.type, Object.keys(dvb.POI_TYPE));
});
示例3: assertPoint
export function assertPoint(point: IPoint) {
assertLocation(point);
assert.oneOf(point.type, Object.keys(POI_TYPE));
}
示例4:
.then(users => {
assert.propertyVal(users[0], 'name', 'foo');
assert.oneOf(users[0].id, [ 1, 2 ]);
});