Questions tagged [testing-libraryreact-native]

7 questions
3
votes
0 answers

Mocking React higher-order components (HOC) with Jest

i am trying to run a unit testing for my react-native component. My component seems complex. i tired all possible ways to get it done. My CheckBox component wrapped with HOC withTheme import { View, Text, Pressable, StyleSheet } from…
2
votes
3 answers

When testing, code that causes React state updates should be wrapped into act(...) - with simple react-native nested screen/components with jest axios

I am new to unit testing/jest, but I know some about react native. I want to write a test for my HomeScreen, which contains a component that makes a simple request. The code runs without any issue but fails when I run it with…
1
vote
1 answer

@testing-library/react-native render method timeout for simple component

I am testing the app navigation stack, and when rendering a very basic component it times out with the below error though there is no heavy loading in the component. Error: Ran all test suites. error Command failed with exit code 1. info Visit…
Nitin
  • 7,455
  • 2
  • 32
  • 51
0
votes
0 answers

Not able to get coverage for the code written inside viewAbilityConfigCallbackPairs in jest

I have basically written a code of flatlist and used viewabilityConfigCallbackPairs props. Divided UI code and business logic in separate file. Now the issue is I am trying to write testcase using jest for the same but it seems…
0
votes
1 answer

fireEvent.change() does not work - it has undefined value on input change

I'm getting undefined for event.target.value on an input change event triggered by fireEvent.change() in the code bellow: import "@testing-library/jest-dom/extend-expect"; import React from "react"; import { fireEvent, render, } from…
Jeff Pal
  • 1,519
  • 1
  • 17
  • 28
0
votes
2 answers

After added dynamic columns test case is failed

I am new to testing-library. First test case is fail because I have dynamically added radio or check base on mode. Previously this test case in pass. After I have added extra column, test case is fail. How can I change to pass the test. …
Alex Aung
  • 2,637
  • 5
  • 34
  • 63
0
votes
2 answers

React-Navigation V6 Drawer.Item drawerItemStyle: { display: "none" } still renders DrawerItem in react-test-renderer

I am trying to write a test where Drawer item goes from invisible to visible. The way I am implementing the visibility switch is by toggling the drawerItemStyle prop on the Drawer item from display: "none" to display: "flex". This works in an…