本文整理汇总了TypeScript中graphql-request.request函数的典型用法代码示例。如果您正苦于以下问题:TypeScript request函数的具体用法?TypeScript request怎么用?TypeScript request使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了request函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test("email not confirmed", async () => {
await request(
process.env.TEST_HOST as string,
registerMutation(email, password)
);
await loginExpectError(email, password, confirmEmailError);
await User.update({ email }, { confirmed: true });
await loginExpectError(email, "asdasd", invalidLogin);
const response = await request(
process.env.TEST_HOST as string,
loginMutation(email, password)
);
expect(response).toEqual({
login: null
})
})
示例2: test
test("check bad password", async () => {
// Catch bad/invalid password with valid email
const response4: any = await request(
process.env.TEST_HOST as string,
mutation(email, "bo")
);
expect(response4).toEqual({
register: [
{
"message": passwordNotLongEnough,
"path": "password"
}
]
})
});
示例3: async
const loginExpectError = async (e: string, p: string, errMsg: string) => {
const response = await request(
process.env.TEST_HOST as string,
loginMutation(e, p)
);
expect(response).toEqual({
login: [
{
path: "email",
message: errMsg
}
]
})
}