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


TypeScript assert.deepEqual方法代码示例

本文整理汇总了TypeScript中test.assert.deepEqual方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.deepEqual方法的具体用法?TypeScript assert.deepEqual怎么用?TypeScript assert.deepEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test.assert的用法示例。


在下文中一共展示了assert.deepEqual方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

 it("seconds", () => {
   assert.deepEqual(formatDurationAsMessage(38), {
     id: "duration.seconds",
     values: { x: "38" },
   });
   assert.deepEqual(formatDurationAsMessage(123), {
     id: "duration.minutes",
     values: { x: "2" },
   });
   assert.deepEqual(formatDurationAsMessage(3800), { id: "duration.hour" });
   assert.deepEqual(formatDurationAsMessage(3600 * 4 + 120), {
     id: "duration.hours",
     values: { x: "4" },
   });
 });
开发者ID:itchio,项目名称:itch,代码行数:15,代码来源:datetime.spec.ts

示例2: it

  it("groupIdBy", () => {
    assert.deepEqual(groupIdBy(null, "gameId"), {});
    assert.deepEqual(groupIdBy(undefined, "gameId"), {});
    assert.deepEqual(groupIdBy([], "gameId"), {});
    assert.deepEqual(groupIdBy({}, "gameId"), {});

    const items = [
      { id: 1, gameId: 11 },
      { id: 4, gameId: 44 },
      { id: 7, gameId: 77 },
      { id: 77, gameId: 77 },
    ];

    assert.deepEqual(groupIdBy(items, "gameId"), {
      11: [1],
      44: [4],
      77: [7, 77],
    } as any);

    assert.deepEqual(
      groupIdBy<typeof items[0]>(items, o => String(o.gameId * 10)),
      {
        110: [1],
        440: [4],
        770: [7, 77],
      } as any
    );

    assert.deepEqual(groupIdBy(items, "id"), {
      1: [1],
      4: [4],
      7: [7],
      77: [77],
    } as any);

    const itemMap = indexBy(items, "id");

    assert.deepEqual(groupIdBy(itemMap, "gameId"), {
      11: [1],
      44: [4],
      77: [7, 77],
    } as any);

    assert.deepEqual(groupIdBy(itemMap, "id"), {
      1: [1],
      4: [4],
      7: [7],
      77: [77],
    } as any);
  });
开发者ID:itchio,项目名称:itch,代码行数:50,代码来源:group-id-by.spec.ts

示例3: it

  it("gets records by IDs, being chill about null values", () => {
    const records = {
      "12": {
        word: "twelve",
      },
      "34": {
        word: "thirty-four",
      },
      "56": {
        word: "fifty-six",
      },
    };

    assert.deepEqual(getByIds(null, []), []);
    assert.deepEqual(getByIds(records, null), []);
    assert.deepEqual(getByIds(records, []), []);
    assert.deepEqual(getByIds(records, ["34"]), [{ word: "thirty-four" }]);
    assert.deepEqual(getByIds(records, ["56", "1024", "12"]), [
      { word: "fifty-six" },
      { word: "twelve" },
    ]);
  });
开发者ID:itchio,项目名称:itch,代码行数:22,代码来源:get-by-ids.spec.ts

示例4: it

  it("camelifyObject", () => {
    assert.deepEqual(
      camelifyObject({
        heed: 12,
        the_call: {
          display_name: "waffles",
        },
        alreadyDone: ["dont_touch_me"],
      }),
      {
        heed: 12,
        theCall: {
          displayName: "waffles",
        },
        alreadyDone: ["dont_touch_me"],
      }
    );

    const date = new Date();
    assert.deepEqual(camelifyObject({ created_at: date }), {
      createdAt: date,
    });
  });
开发者ID:itchio,项目名称:itch,代码行数:23,代码来源:camelify.spec.ts


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