本文整理汇总了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;未经允许,请勿转载。 |
请发表评论