本文整理汇总了TypeScript中chai.assert.containSubset方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.containSubset方法的具体用法?TypeScript assert.containSubset怎么用?TypeScript assert.containSubset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.containSubset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('Extracts attributes from observedAttributes', () => {
const element = elements.get('vanilla-with-observed-attributes')!;
assert.containSubset(Array.from(element.attributes.values()), [
{
description: 'When given the element is totally inactive',
name: 'disabled',
type: 'boolean',
sourceRange:
{start: {column: 6, line: 25}, end: {column: 16, line: 25}}
},
{
description: 'When given the element is expanded',
name: 'open',
type: 'boolean',
sourceRange:
{start: {column: 6, line: 27}, end: {column: 12, line: 27}}
},
{
description: '',
name: 'foo',
sourceRange:
{start: {column: 14, line: 27}, end: {column: 19, line: 27}},
},
{
description: '',
name: 'bar',
sourceRange:
{start: {column: 21, line: 27}, end: {column: 26, line: 27}},
}
]);
});
示例2: test
test('warns for non-resolvable bare specifiers', async () => {
const {features, warnings} = await runScanner(
analyzer,
new JavaScriptImportScanner({moduleResolution: 'node'}),
'javascript/module-with-not-found-named-import.js');
assert.equal(warnings.length, 1);
assert.containSubset(warnings, [{code: 'cant-resolve-module-specifier'}]);
assert.containSubset(features, [
{
type: 'js-import',
url: undefined,
lazy: false,
},
]);
});
示例3: test
test('finds imports', async () => {
const {features} = await runScanner(
analyzer, new JavaScriptImportScanner(), 'javascript/module.js');
assert.containSubset(features, [
{
type: 'js-import',
url: './submodule.js',
lazy: false,
},
]);
});
示例4: test
test('can infer properties assigned to in the constructor', async () => {
const elements = await getElements('test-element-16.js');
const [element] = elements;
const elementData = await Promise.all(elements.map(getTestProps));
assert.deepEqual(elementData, [
{
className: 'TestElement',
tagName: 'test-element',
superClass: 'Polymer.Element',
description: '',
summary: '',
attributes: [],
properties: [
{
name: 'foo',
description: 'This description lives in the constructor.',
type: 'string | null | undefined'
},
{
name: 'constructorOnly_',
description: 'This is a private field on the element.',
type: 'number'
}
],
methods: [],
warningUnderlines: [],
},
]);
assert.containSubset([...element.properties.values()], [
{
name: 'foo',
privacy: 'protected',
description: 'This description lives in the constructor.',
type: 'string | null | undefined',
default: `'bar'`,
published: true,
notify: true,
warnings: [],
},
{
name: 'constructorOnly_',
privacy: 'private',
description: 'This is a private field on the element.',
type: 'number',
readOnly: true,
warnings: [],
}
]);
});
示例5: test
test(testName, async () => {
getReleasesStub.returns(Promise.resolve(basicReleasesResponse));
const release = await github.getSemverRelease('^v2.0.0');
assert.containSubset(release, {name: 'v2.1.0'});
});