|
1 | 1 | import React from 'react'
|
2 | 2 | import { instance, mock } from 'ts-mockito'
|
3 |
| -import { fireEvent, screen, render } from 'uiSrc/utils/test-utils' |
4 |
| -import ScanMore, { Props } from './KeysSummary' |
| 3 | +import { render } from 'uiSrc/utils/test-utils' |
| 4 | +import KeysSummary, { Props } from './KeysSummary' |
5 | 5 |
|
6 | 6 | const mockedProps = mock<Props>()
|
7 | 7 |
|
8 |
| -describe('ActionBar', () => { |
| 8 | +describe('KeysSummary', () => { |
9 | 9 | it('should render', () => {
|
10 |
| - expect(render(<ScanMore {...instance(mockedProps)} />)).toBeTruthy() |
| 10 | + expect(render(<KeysSummary {...instance(mockedProps)} />)).toBeTruthy() |
11 | 11 | })
|
12 | 12 |
|
13 |
| - it('should call "onCloseActionBar"', () => { |
14 |
| - const handleClick = jest.fn() |
15 |
| - |
16 |
| - const renderer = render( |
17 |
| - <ScanMore {...instance(mockedProps)} onCloseActionBar={handleClick} /> |
| 13 | + it('should "Scanning..." be in the document until loading and totalItemsCount == 0 ', () => { |
| 14 | + const { queryByTestId } = render( |
| 15 | + <KeysSummary {...instance(mockedProps)} loading totalItemsCount={0} /> |
18 | 16 | )
|
| 17 | + expect(queryByTestId('scanning-text')).toBeInTheDocument() |
| 18 | + }) |
19 | 19 |
|
20 |
| - expect(renderer).toBeTruthy() |
21 |
| - |
22 |
| - fireEvent.click(screen.getByTestId('cancel-selecting')) |
23 |
| - expect(handleClick).toHaveBeenCalledTimes(1) |
| 20 | + it('should Keys summary be in the document meanwhile totalItemsCount != 0 ', () => { |
| 21 | + const { queryByTestId } = render( |
| 22 | + <KeysSummary {...instance(mockedProps)} totalItemsCount={2} /> |
| 23 | + ) |
| 24 | + expect(queryByTestId('keys-summary')).toBeInTheDocument() |
24 | 25 | })
|
25 | 26 | })
|
0 commit comments