diff --git a/src/ducks/balance/ImportGroupPanel.spec.jsx b/src/ducks/balance/ImportGroupPanel.spec.jsx index eaa1c4a2d3..1721894e3b 100644 --- a/src/ducks/balance/ImportGroupPanel.spec.jsx +++ b/src/ducks/balance/ImportGroupPanel.spec.jsx @@ -5,11 +5,26 @@ import ImportGroupPanel from 'ducks/balance/ImportGroupPanel' import { render } from '@testing-library/react' -import { createMockClient } from 'cozy-client' +import CozyClient from 'cozy-client' +import CozyRealtime from 'cozy-realtime' + +jest.mock('cozy-realtime') describe('ImportGroupPanel', () => { const setup = ({ jobsInProgress }) => { - const client = createMockClient({}) + const client = new CozyClient({}) + client.query = jest.fn().mockResolvedValue({ + data: { + attributes: { + name: '' + } + } + }) + + CozyRealtime.mockReturnValue({ + subscribe: () => {}, + unsubscribe: () => {} + }) const root = render( @@ -25,15 +40,14 @@ describe('ImportGroupPanel', () => { expect(root.queryByText('Import in progress')).toBeNull() }) - // TODO - // it('should displays multiple konnector in progress', () => { - // const jobsInProgress = [ - // { konnector: 'caissedepargne1', account: '1111' }, - // { konnector: 'caissedepargne1', account: '2222' } - // ] - // const { root } = setup({ jobsInProgress }) - // - // expect(root.getByText('Importing accounts')).toBeTruthy() - // expect(root.getAllByText('Import in progress').length).toEqual(3) - // }) + it('should displays multiple konnector in progress', () => { + const jobsInProgress = [ + { konnector: 'caissedepargne1', account: '1111' }, + { konnector: 'boursorama83', account: '2222' } + ] + const { root } = setup({ jobsInProgress }) + + expect(root.getByText('Import accounts')).toBeTruthy() + expect(root.getAllByText('Import in progress').length).toEqual(2) + }) })