Skip to content

Commit

Permalink
test: Add tests for ImportGroupPanel component
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Pires committed Mar 8, 2021
1 parent 6e17b15 commit e932082
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions src/ducks/balance/ImportGroupPanel.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<AppLike client={client} jobsInProgress={jobsInProgress}>
Expand All @@ -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)
})
})

0 comments on commit e932082

Please sign in to comment.