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


TypeScript TestContext.deepEqual方法代码示例

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


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

示例1: async

  fn: async (t: TestContext) => {
    const ted = await Tyr.byName.user.findOne({ query: { name: 'ted' } });
    if (!ted) {
      throw new Error(`No ted found`);
    }

    const query = `
      query getUserById($id: [ID]) {
        user(_id: $id) {
          status {
            name
          }
        }
      }
    `;

    const result = await Tyr.graphql({
      query,
      variables: {
        id: [ted.$id]
      }
    });

    const expected = {
      data: {
        user: {
          status: {
            name: 'Active'
          }
        }
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:35,代码来源:enum-collection.ts

示例2: async

  fn: async (t: TestContext) => {
    const query = `
      query userNameQuery {
        users {
          name
          teamIds {
            name,
            organizationId {
              name
            }
          }
        }
      }
    `;

    const result = await Tyr.graphql({ query });

    const expected = {
      data: {
        users: [
          {
            name: 'ben',
            teamIds: [
              {
                name: 'burritoMakers',
                organizationId: {
                  name: 'Chipotle'
                }
              },
              {
                name: 'chipotleMarketing',
                organizationId: {
                  name: 'Chipotle'
                }
              }
            ]
          },
          {
            name: 'ted',
            teamIds: [
              {
                name: 'cavaEngineers',
                organizationId: {
                  name: 'Cava'
                }
              }
            ]
          },
          {
            name: 'noTeams',
            teamIds: []
          }
        ]
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:58,代码来源:array-populated.ts

示例3: async

  fn: async (t: TestContext) => {
    const burritoMakers = await Tyr.byName.team.findOne({
      query: { name: 'burritoMakers' }
    });
    if (!burritoMakers) {
      throw new Error(`No burrito`);
    }

    const query = `
      query userNameQuery {
        users {
          name
          teamIds(_id: "${burritoMakers.$id}") {
            name,
            organizationId {
              name
            }
          }
        }
      }
    `;

    const result = await Tyr.graphql({ query });

    const expected = {
      data: {
        users: [
          {
            name: 'ben',
            teamIds: [
              {
                name: 'burritoMakers',
                organizationId: {
                  name: 'Chipotle'
                }
              }
            ]
          },
          {
            name: 'ted',
            teamIds: []
          },
          {
            name: 'noTeams',
            teamIds: []
          }
        ]
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:52,代码来源:sub-document-parameters.ts

示例4: async

  fn: async (t: TestContext) => {
    const ted = await Tyr.byName.user.findOne({ query: { name: 'ted' } });
    if (!ted) {
      throw new Error(`No ted`);
    }

    const query = `
      query getUserById($id: [ID]) {
        user(_id: $id) {
          name
          teamIds {
            name,
            organizationId {
              name
            }
          }
        }
      }
    `;

    const result = await Tyr.graphql({
      query,
      variables: {
        id: [ted.$id]
      }
    });

    const expected = {
      data: {
        user: {
          name: 'ted',
          teamIds: [
            {
              name: 'cavaEngineers',
              organizationId: {
                name: 'Cava'
              }
            }
          ]
        }
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:45,代码来源:variables.ts

示例5: async

  fn: async (t: TestContext) => {
    const orgId = 'organizationId';
    const gql = Tyr.graphql;

    const result = await gql`
      query userNameQuery {
        users {
          name
          ${orgId} {
            name
          }
        }
      }
    `;

    const expected = {
      data: {
        users: [
          {
            name: 'ben',
            organizationId: {
              name: 'Chipotle'
            }
          },
          {
            name: 'ted',
            organizationId: {
              name: 'Cava'
            }
          },
          {
            name: 'noTeams',
            organizationId: {
              name: 'Chipotle'
            }
          }
        ]
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:42,代码来源:template-tag.ts

示例6: async

  fn: async (t: TestContext) => {
    const query = `
      query userNameQuery {
        users(name: "ben") {
          computed
        }
      }
    `;

    const result = await Tyr.graphql({ query });

    const expected = {
      data: {
        users: [
          {
            computed: 'Hello ben from a computed property!'
          }
        ]
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:23,代码来源:computed-property-projection.ts

示例7: async

  fn: async (t: TestContext) => {
    const query = `
      query userQuery {
        user(name: "ben") {
          ...userProps
        }
      }

      fragment userProps on user {
        name
        teamIds {
          name
        }
      }
    `;

    const result = await Tyr.graphql({ query });

    const expected = {
      data: {
        user: {
          name: 'ben',
          teamIds: [
            {
              name: 'burritoMakers'
            },
            {
              name: 'chipotleMarketing'
            }
          ]
        }
      }
    };

    t.deepEqual<ExecutionResult>(result, expected);
  }
开发者ID:tyranid-org,项目名称:tyranid,代码行数:36,代码来源:fragments.ts

示例8: testAllJoynTypeRoundTrip

// Test that an AllJoyn schema type code can be converted to a JSON schema and back.
function testAllJoynTypeRoundTrip(t: TestContext, allJoynType: string, expectedSchema: JsonSchema) {
    let schema: JsonSchema = AllJoynSchemaReader.allJoynTypeToJsonSchema(allJoynType);
    t.deepEqual(schema, expectedSchema);
    let convertedType: string = AllJoynSchemaWriter.jsonSchemaToAllJoynType(schema);
    t.is(convertedType, allJoynType);
}
开发者ID:arjun-msft,项目名称:opent2t,代码行数:7,代码来源:AllJoynSchemaTests.ts

示例9: macro

function macro(t : TestContext, input : string, expected : any) {
	t.deepEqual(referrer(input), expected);
}
开发者ID:mariusGundersen,项目名称:Ekkiog,代码行数:3,代码来源:getRepoFromUrl.test.ts


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