Created
February 15, 2024 11:44
-
-
Save proton0210/a156899258d7b3f05866cde765609a66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appsync-todo-operaton.test.ts | |
"graphql": "jest --verbose ./__tests__/test_cases/e2e/appsync-todo-operaton.test", | |
const createTodoMutation = `mutation CreateTodo($input: CreateTodoInput!) { | |
createTodo(input: $input) { | |
UserID | |
TodoID | |
title | |
completed | |
} | |
}`; | |
utils.ts | |
import { GraphQLClient } from "graphql-request"; | |
const client = new GraphQLClient(process.env.GRAPHQL_URL as string); | |
export const makeGraphQLRequest = async ( | |
query: string, | |
variables = {}, | |
accessToken: string | |
) => { | |
client.setHeader("Authorization", `${accessToken}`); | |
try { | |
return await client.request(query, variables); | |
} catch (err) { | |
throw err; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment