about summary refs log tree commit diff
path: root/__tests__/view/screens/Search.test.tsx
blob: c53e80b42d3b9f4a6860066989c6baa496834001 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react'
import {Search} from '../../../src/view/screens/Search'
import {cleanup, fireEvent, render} from '../../../jest/test-utils'

describe('Search', () => {
  jest.useFakeTimers()
  const mockedProps = {
    navIdx: '0-0',
    params: {
      name: 'test name',
    },
    visible: true,
  }

  afterAll(() => {
    jest.clearAllMocks()
    cleanup()
  })

  it('renders with query', async () => {
    const {findByTestId} = render(<Search {...mockedProps} />)
    const searchTextInput = await findByTestId('searchTextInput')

    expect(searchTextInput).toBeTruthy()
    fireEvent.changeText(searchTextInput, 'test')

    const searchScrollView = await findByTestId('searchScrollView')
    expect(searchScrollView).toBeTruthy()
  })
})