Unit Test: React-Bootstrap Modal

Yuvraj Patil
Aug 25, 2019

--

Unit Test: React-Bootstrap Modal

Writing unit test always help in longer run. Now a days almost all frameworks and libraries are supporting unit testing. In React Bootstrap, there is documentation for using the unit test cases but still writing unit test cases for React-Bootstrap Modal can get confusing.

After spending hours on it finally I am able to write test cases for it. These code snippets can be used for other React-Bootstrap components as well (by changing the corresponding names).

Modal Source Code

Modal Test cases:

Packages used:

"react": "^16.9.0",  
"react-bootstrap": "^1.0.0-beta.9",
"react-dom": "^16.9.0",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",

Happy Unit Testing.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Yuvraj Patil
Yuvraj Patil

Written by Yuvraj Patil

Riding the dragon in realm of React Native. Website: https://.www.yuvrajpatil.com

Responses (1)

Write a response