Skip to content

Commit

Permalink
[DEV REVIEW]: remove les act vides
Browse files Browse the repository at this point in the history
  • Loading branch information
imouandjolobe-pass committed Sep 20, 2024
1 parent 9446578 commit be46306
Showing 1 changed file with 36 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
import { SearchState } from 'features/search/types'
import { mockedSuggestedVenue } from 'libs/venue/fixtures/mockedSuggestedVenues'
import { reactQueryProviderHOC } from 'tests/reactQueryProviderHOC'
import { act, fireEvent, render, screen } from 'tests/utils'
import { fireEvent, render, screen } from 'tests/utils'

const venue = mockedSuggestedVenue

Expand Down Expand Up @@ -76,7 +76,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('Séances de cinéma')

expect(screen.queryByText('Cinéma, films et séries')).not.toBeOnTheScreen()
})
Expand All @@ -95,7 +95,7 @@ describe('AutocompleteOfferItem component', () => {

await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockSendEvent).toHaveBeenCalledTimes(1)
})
Expand All @@ -115,9 +115,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('E-books')).toBeOnTheScreen()
expect(await screen.findByText('E-books')).toBeOnTheScreen()
})

it('should display the search group if it is irrelevant', async () => {
Expand All @@ -134,9 +132,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('Livres')).toBeOnTheScreen()
expect(await screen.findByText('Livres')).toBeOnTheScreen()
})
})

Expand All @@ -153,7 +149,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('Séances de cinéma')).not.toBeOnTheScreen()
})
Expand All @@ -170,7 +166,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('Séances de cinéma')).not.toBeOnTheScreen()
})
Expand All @@ -194,9 +190,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -229,9 +225,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -261,9 +257,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -293,9 +289,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -324,9 +320,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -356,9 +352,9 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -388,9 +384,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -419,9 +415,9 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))
fireEvent.press(screen.getByTestId('autocompleteOfferItem_1'))

await act(() => {})
await screen.findByText('cinéma')

expect(mockDispatch).toHaveBeenNthCalledWith(1, {
type: 'SET_STATE',
Expand Down Expand Up @@ -453,9 +449,8 @@ describe('AutocompleteOfferItem component', () => {
wrapper: ({ children }) => reactQueryProviderHOC(children),
}
)
await act(() => {})

expect(screen.getByText('Séances de cinéma')).toBeOnTheScreen()
expect(await screen.findByText('Séances de cinéma')).toBeOnTheScreen()
})

it('when it associated to the most popular category', async () => {
Expand All @@ -471,9 +466,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('Arts visuels')).toBeOnTheScreen()
expect(await screen.findByText('Arts visuels')).toBeOnTheScreen()
})
})

Expand All @@ -491,7 +484,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('dans')).not.toBeOnTheScreen()
})
Expand All @@ -509,7 +502,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('dans')).not.toBeOnTheScreen()
})
Expand All @@ -529,7 +522,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('Arts visuels')).not.toBeOnTheScreen()
})
Expand All @@ -547,7 +540,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('dans CD_VINYLES')).not.toBeOnTheScreen()
})
Expand All @@ -567,7 +560,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('Musées & visites culturelles')).not.toBeOnTheScreen()
})
Expand All @@ -585,7 +578,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('Musées & visites culturelles')).not.toBeOnTheScreen()
})
Expand All @@ -603,7 +596,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})
await screen.findByText('cinéma')

expect(screen.queryByText('dans')).not.toBeOnTheScreen()
})
Expand All @@ -623,9 +616,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('Concerts & festivals')).toBeOnTheScreen()
expect(await screen.findByText('Concerts & festivals')).toBeOnTheScreen()
})

it('has not native category associated to the suggestion', async () => {
Expand All @@ -641,9 +632,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('Concerts & festivals')).toBeOnTheScreen()
expect(await screen.findByText('Concerts & festivals')).toBeOnTheScreen()
})

it('native category is unknown in the app', async () => {
Expand All @@ -659,9 +648,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('CD, vinyles, musique en ligne')).toBeOnTheScreen()
expect(await screen.findByText('CD, vinyles, musique en ligne')).toBeOnTheScreen()
})

it('native category is Livres Papier', async () => {
Expand All @@ -677,9 +664,7 @@ describe('AutocompleteOfferItem component', () => {
}
)

await act(() => {})

expect(screen.getByText('Livres')).toBeOnTheScreen()
expect(await screen.findByText('Livres')).toBeOnTheScreen()
})
})
})
Expand Down

0 comments on commit be46306

Please sign in to comment.