In the last installment (Part II), we walked through creating and executing our very first test. With that out of the way, let’s move on to something slightly more complicated. Elements that cannot be found typically are elements that are initially hidden. In this post, we’ll cover how to test for an element or component that isn’t found.
This is Part 2 of our series, Using Jest and Testing Library with React Native. This post will cover the steps you’ll need to take to write your first test. We will also break down the code line-by-line, so you have a clear understanding of the process.
In this post, Part 1 of Using Jest and Testing Library with React Native, I’ll give a brief introduction to Jest, Testing Library, and React Native. Then, we’ll walk through how to set each of them up. This will prepare us for Part 2, creating our first test.
Throughout time, there have been certain questions that will always result in great battles. In one recent throw down, I drew my line in the sand and bravely asserted, “Hell no, a hotdog is not a sandwich!”
There are other more dangerous questions that we’ve all heard, of course… is Mac better than PC? Is Android better than iPhone? Are dogs better than cats? That last question is the silliest of all as the correct answer is so very obvious. Regardless, these intriguing questions have often led to disastrous consequences such as sulking and hurt feelings.
Allow me to add another one to the list: Is Test-Driven Development (TDD) a good practice?
I know, provocative. In this blog, I will discuss test-driven development, why many in our field seem to hate it, and why you should choose to still implement some of its main concepts in your development….
When working with RxJS observables, it can get a little tricky to unit test. Sometimes it can be hard to get insight into what is going on with the observable in the test. I’ve personally been frustrated numerous times by trying to test my observables with the subscribe and assert method. This is where marble testing can make testing observables easier.
The main advantage of using marble testing is the marble diagrams. With the diagrams, we have a visual representation of our observables and subscriptions so we can see the interactions between the two. Once the basics are understood, you should be able to get observable tests running in no time.
In this post, I will show you how to get started using Marble testing with an example. By the end, you should have enough information to get started on your journey testing observables. My examples are based on an Angular application using Jasmine, but these can also be applied to different testing frameworks for React and other applications.