当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript assert.hasAllKeys方法代码示例

本文整理汇总了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);
  });
开发者ID:a6802739,项目名称:cockroach,代码行数:30,代码来源:localities.spec.ts

示例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'
            );
        });
开发者ID:fosenutvikling,项目名称:fuhttp-ts,代码行数:31,代码来源:Route.test.ts

示例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);
  });
开发者ID:jordanlewis,项目名称:cockroach,代码行数:20,代码来源:locations.spec.ts

示例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.
开发者ID:Polymer,项目名称:tools,代码行数:16,代码来源:gen-ts_test.ts


注:本文中的chai.assert.hasAllKeys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。