Skip to content

Instantly share code, notes, and snippets.

@proton0210
Created February 15, 2024 11:44
Show Gist options
  • Save proton0210/a156899258d7b3f05866cde765609a66 to your computer and use it in GitHub Desktop.
Save proton0210/a156899258d7b3f05866cde765609a66 to your computer and use it in GitHub Desktop.
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