本文整理匯總了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
}
]
})
}