RocketChat / RocketChat/Rocket.Chat.ReactNative

Skipped test in app/containers/SearchBox/SearchBox.test.tsx

Open
#4,965 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.4k
Forks
1.5k
Avg merge
1d 18h
Merged PRs (30d)
90

Description

There is a skipped test in the test file for <SearchBox />:

https://github.com/RocketChat/Rocket.Chat.ReactNative/blob/4dfc9c70f3ccd00016edf9c11701fda2b3b5f162/app/containers/SearchBox/SearchBox.test.tsx#L36-L44

which is a bit of a visual disturbance every time we run yarn test:

Capture d’écran 2023-03-12 à 16 23 37

From what I understand, this test should simply check that the input's value is set to '' when the (see this PR for more context).

I tried the following implementation:

it('should clear input when clear icon is pressed', async () => {
		const { findByTestId } = render(<SearchBox onChangeText={onChangeTextMock} testID={testSearchInputs.testID} />);

		const component = await findByTestId(testSearchInputs.testID);
		fireEvent.changeText(component, 'new-input-value');
		
		const clearTextInput = await findByTestId('clear-text-input');
		fireEvent.press(clearTextInput);
		expect(onChangeTextMock).toHaveBeenCalledWith('');
	});

and it works.

I'll open a PR to make the change.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open app/containers/SearchBox/SearchBox.test.tsx and review the skipped test at lines 36-44, then read PR 4195 for context. Run yarn test and confirm the SearchBox test is no longer skipped and verifies that pressing the clear control produces the expected empty value.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile, testing
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.