• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript alsatian.AsyncTest函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中alsatian.AsyncTest函数的典型用法代码示例。如果您正苦于以下问题:TypeScript AsyncTest函数的具体用法?TypeScript AsyncTest怎么用?TypeScript AsyncTest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: Expect

  @AsyncTest()
  @TestCase('')
  async getWorksShouldFailWith422WhenPassingAnInvalidArgument(publicKey: string) {
    const response = await this.client.getWorksByPublicKey(publicKey)

    Expect(response.status).toBe(422)
  }
开发者ID:GuilhermeCaruso,项目名称:node,代码行数:7,代码来源:GetWorksByPublicKey.ts


示例2: lookup

    @AsyncTest(".lookup(): Should return data for osm addresses")
    @Timeout(5000)
    public async lookup() {
       const results = await lookup({
           osm_ids: "R136712" //To determine the osm_id, use a NominatimResponse's 'osm_id' and prefix it with the first letter of its `osm_type`.
       })

        Expect(results.length >= 1).toBe(true);
        
        const result = results[0];
        
        Expect(typeof(result.place_id)).toBe("string");
        Expect(typeof(result.licence)).toBe("string");
        Expect(typeof(result.lat)).toBe("string");
        Expect(typeof(result.lon)).toBe("string");
        Expect(result.display_name).toEqual("Minneapolis, Hennepin County, Minnesota, United States of America");
        Expect(result.address).not.toBeNull();
        Expect(result.address).toBeDefined();

        const address = result.address;
        
        Expect(address.city).toEqual("Minneapolis");
        Expect(address.county).toEqual("Hennepin County");
        Expect(address.state).toEqual("Minnesota");
        Expect(address.country).toEqual("United States of America");
    }
开发者ID:nozzlegear,项目名称:nominatim-browser,代码行数:26,代码来源:lookup.ts


示例3: getAddressWithCoords

    @AsyncTest(".getAddressWithCoords(): Should return address data with coordinates")
    @Timeout(5000)
    public async getAddressWithCoords() {
        const results = await geocode({
            city: "Minneapolis",
            state: "MN",
            country: "US",
            addressdetails: true
        });

        Expect(results.length >= 1).toBe(true);

        const result = results[0];

        Expect(typeof(result.place_id)).toBe("string");
        Expect(typeof(result.licence)).toBe("string");
        Expect(typeof(result.osm_id)).toBe("string");
        Expect(typeof(result.lat)).toBe("string");
        Expect(typeof(result.lon)).toBe("string");
        Expect(result.display_name).toEqual("Minneapolis, Hennepin County, Minnesota, United States of America");
        Expect(result.address).not.toBeNull();
        Expect(result.address).toBeDefined();

        const address = result.address;

        Expect(address.city).toEqual("Minneapolis");
        Expect(address.county).toEqual("Hennepin County");
        Expect(address.state).toEqual("Minnesota");
        Expect(address.country).toEqual("United States of America");
    }
开发者ID:nozzlegear,项目名称:nominatim-browser,代码行数:30,代码来源:geocode.ts


示例4: asyncNoErrorThrown

  @AsyncTest()
  public async asyncNoErrorThrown() {
    const errorFunction = async () => {
      return new Promise(resolve => {
        setTimeout(resolve, 400);
      });
    };

    await Expect(errorFunction).not.toThrowAsync();
  }
开发者ID:alsatian-test,项目名称:alsatian,代码行数:10,代码来源:to-throw.spec.ts


示例5: asyncErrorNotThrown

  @AsyncTest()
  public async asyncErrorNotThrown() {
    const errorFunction = async () => {
      return new Promise((resolve, reject) => {
        setTimeout(resolve, 400);
      });
    };

    await Expect(errorFunction).toThrowAsync();
  }
开发者ID:alsatian-test,项目名称:alsatian,代码行数:10,代码来源:to-throw.spec.ts


示例6: getWorksByPublicKeyShouldSucceed

  @AsyncTest()
  @TestCase(TheRaven.publicKey)
  @TestCase(TheMurdersInTheRueMorgue.publicKey)
  @TestCase(AStudyInScarlet.publicKey)
  async getWorksByPublicKeyShouldSucceed(publicKey: string) {
    const response = await this.client.getWorksByPublicKey(publicKey)

    Expect(response.status).toBe(200)
    Expect(response.ok).toBeTruthy()
  }
开发者ID:GuilhermeCaruso,项目名称:node,代码行数:10,代码来源:GetWorksByPublicKey.ts


示例7: asyncErrorUnexpectedly

  @AsyncTest()
  public async asyncErrorUnexpectedly() {
    const errorFunction = async () => {
      return new Promise((resolve, reject) => {
        setTimeout(() => reject(new Error("error")), 400);
      });
    };

    await Expect(errorFunction).not.toThrowAsync();
  }
开发者ID:alsatian-test,项目名称:alsatian,代码行数:10,代码来源:to-throw.spec.ts


示例8: asnycExactErrorNotThrown

  @AsyncTest()
  public async asnycExactErrorNotThrown() {
    const errorFunction = async () => {
      return new Promise((resolve, reject) => {
        setTimeout(() => reject(new Error("error")), 400);
      });
    };

    await Expect(errorFunction).toThrowErrorAsync(TypeError, "specific error");
  }
开发者ID:alsatian-test,项目名称:alsatian,代码行数:10,代码来源:to-throw.spec.ts


示例9: postWorkShouldSucceedWithEmptyResponse

  @AsyncTest()
  async postWorkShouldSucceedWithEmptyResponse() {
    const claim = createClaim(Key1.privateKey, ClaimType.Work, {
      name: 'Name',
    })

    const postResponse = await this.client.postWork(claim)
    const postResponseBody = await postResponse.text()

    Expect(postResponseBody).toBe('')
  }
开发者ID:GuilhermeCaruso,项目名称:node,代码行数:11,代码来源:PostWork.ts


示例10: createClaim

  @AsyncTest()
  async postWorkShouldSucceedWith202() {
    const claim = createClaim(Key1.privateKey, ClaimType.Work, {
      name: 'Name',
    })

    const postResponse = await this.client.postWork(claim)

    Expect(postResponse.ok).toBeTruthy()
    Expect(postResponse.status).toBe(202)
  }
开发者ID:GuilhermeCaruso,项目名称:node,代码行数:11,代码来源:PostWork.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript alsatian.Expect函数代码示例发布时间:2022-05-28
下一篇:
TypeScript align-text.default函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap