Skip to content

Latest commit

 

History

History

souvlaki-apollo

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🌯🚀 souvlaki-apollo 🚀🌯

Souvlaki wrapper helper for apollo-client. Wraps your components in an ApolloProvider so you don't have to.

Installation

yarn add -D souvlaki souvlaki-apollo
# OR
npm i -D souvlaki souvlaki-apollo

Usage

// MyComponent.test.tsx
import { wrap } from 'souvlaki';
import { withApollo } from 'souvlaki-apollo';
import { render, screen } from '@testing-library/react';
import MyComponent from '../MyComponent';

describe('MyComponent', () => {
  it('wraps the component with an ApolloProvider, with a default client', () => {
    render(<MyComponent />, { wrapper: wrap(withApollo()) });

    // expect...
  });

  it('wraps the component with an ApolloProvider, with a custom client', () => {
    const client = buildApolloClient();
    render(<MyComponent />, { wrapper: wrap(withApollo(client)) });

    // expect...
  });
});