Vue Test Utils / apollo-composable check if useMutation was called

Viewed 129

I have the component AddEmployeeModal.vue where I want to test if UseMutation from vue/apollo-composable gets called

// AddEmployeeModal.vue:
import { provideApolloClient, useMutation, useQuery } from '@vue/apollo-composable';
import { apolloClient } from '@/apollo/ApolloClient';
import {
  CreateEmployeeDocument,
  UpdateEmployeeDocument,
} from '@/generated/graphql';

provideApolloClient(apolloClient);

const { mutate: addEmployee } = useMutation(CreateEmployeeDocument);
const { mutate: updateEmployee } = useMutation(UpdateEmployeeDocument);

I think I need to mock the useMutation function but I'm not sure how to mock a library function.

0 Answers
Related