1
votes

In our react-native application, we are developing custom style component for our component.

The style component contains StyleSheet example:

export default StyleSheet.create({
  container: {
    flexGrow: 1,
    justifyContent: "center",
    alignItems: "center",
    borderTopWidth: 1,
  },
});

As this component is imported in our component and when we do unit testing of our component it goes 30 times in it and shows that if and else part were not run which leads to less coverage(style component is imported in the component)

So I have included a screenshot which explains the issue. Note that rest whole component is tested and fully covered. So the coverage which is left is for style component.

1

1 Answers

0
votes

It should return an object that looks like this

style={
    Object {
      flexGrow: 1,
      justifyContent: "center",
      alignItems: "center",
      borderTopWidth: 1,
    }
}

You can compare it with it and see if it is worth it or not

You can understand the direction of my thinking through this link