本文整理汇总了TypeScript中chai.assert.hasAllKeys方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.hasAllKeys方法的具体用法?TypeScript assert.hasAllKeys怎么用?TypeScript assert.hasAllKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.hasAllKeys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("organizes nodes by locality", function() {
const state = makeStateWithLocalities([
[{ key: "region", value: "us-east-1" }],
[{ key: "region", value: "us-east-2" }],
]);
const tree = selectLocalityTree(state);
assert.isEmpty(tree.tiers);
assert.isEmpty(tree.nodes);
assert.hasAllKeys(tree.localities, ["region"] );
const regions = tree.localities.region;
assert.hasAllKeys(regions, ["us-east-1", "us-east-2"]);
const usEast1 = regions["us-east-1"];
assert.isEmpty(usEast1.localities);
assert.deepEqual(usEast1.tiers, [{ key: "region", value: "us-east-1" }]);
assert.lengthOf(usEast1.nodes, 1);
const usEast2 = regions["us-east-2"];
assert.isEmpty(usEast2.localities);
assert.deepEqual(usEast2.tiers, [{ key: "region", value: "us-east-2" }]);
assert.lengthOf(usEast2.nodes, 1);
});
示例2: it
it('should add mix route names as sub-routes', () => {
let parentRoute = new Route();
parentRoute.get('/a', () => {});
parentRoute.get('/b', () => {});
let subRoute = new Route();
subRoute.get('/aa', () => {});
subRoute.get('/ab', () => {});
parentRoute.add('/a', subRoute);
parentRoute.add('b/', subRoute);
parentRoute.add(' c', subRoute);
assert.hasAllKeys(parentRoute.nextRoute, ['a', 'b', 'c'], 'Sub route not added');
assert.hasAnyKeys(
parentRoute.nextRoute['a'].nextRoute,
['aa', 'ab'],
'Sub-sub route `a` not added'
);
assert.hasAnyKeys(
parentRoute.nextRoute['b'].nextRoute,
['aa', 'ab'],
'Sub-sub route `b` not added'
);
assert.hasAnyKeys(
parentRoute.nextRoute['c'].nextRoute,
['aa', 'ab'],
'Sub-sub route `c` not added'
);
});
示例3: it
it("makes a key for each locality value in each tier", function() {
const cities = [
"nyc",
"sf",
"walla-walla",
];
const dataCenters = [
"us-east-1",
"us-west-1",
];
const cityLocations = cities.map((city) => ({ locality_key: "city", locality_value: city }));
const dcLocations = dataCenters.map((dc) => ({ locality_key: "data-center", locality_value: dc }));
const state = makeStateWithLocations(cityLocations.concat(dcLocations));
const tree = selectLocationTree(state);
assert.hasAllKeys(tree, ["city", "data-center"]);
assert.hasAllKeys(tree.city, cities);
assert.hasAllKeys(tree["data-center"], dataCenters);
});
示例4: test
test(fixture, async () => {
let config: Config = {};
const configPath = path.join(fixtures, fixture, 'gen-tsd.json');
if (fs.existsSync(configPath)) {
config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
}
config.hideWarnings = true;
const actual =
await generateDeclarations(path.join(fixtures, fixture), config);
const golden = readDirAsMap(path.join(goldens, fixture));
assert.hasAllKeys(actual, [...golden.keys()]);
for (const filename of actual.keys()) {
assert.equal(actual.get(filename), golden.get(filename), filename);
}
}).timeout(30000); // These tests can take a long time.