fix tests

This commit is contained in:
Moriz Wahl 2021-10-26 15:37:34 +02:00
parent 1a17d08df6
commit 4f8ddec025

View File

@ -1,10 +1,33 @@
import { ApolloClient, ApolloLink, InMemoryCache, HttpLink } from 'apollo-boost'
import './main'
import CONFIG from './config'
jest.mock('apollo-boost')
jest.mock('apollo-boost', () => {
return {
__esModule: true,
ApolloClient: jest.fn(),
ApolloLink: jest.fn(() => {
return { concat: jest.fn() }
}),
InMemoryCache: jest.fn(),
HttpLink: jest.fn(),
}
})
describe('main', () => {
it('is there', () => {
expect(true).toBeTruthy()
it('calls the HttpLink', () => {
expect(HttpLink).toBeCalledWith({ uri: CONFIG.GRAPHQL_URI })
})
it('calls the ApolloLink', () => {
expect(ApolloLink).toBeCalled()
})
it('calls the ApolloClient', () => {
expect(ApolloClient).toBeCalled()
})
it('calls the InMemoryCache', () => {
expect(InMemoryCache).toBeCalled()
})
})