From 4f8ddec02555fa4ce6edd6e3cd4b8068c65ead01 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 26 Oct 2021 15:37:34 +0200 Subject: [PATCH] fix tests --- admin/src/main.test.js | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/admin/src/main.test.js b/admin/src/main.test.js index bb70c1e1f..0af7dfa9f 100644 --- a/admin/src/main.test.js +++ b/admin/src/main.test.js @@ -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() }) })