Definitions – Unit testing
What is unit testing?
Unit testing simply verifies that individual units of code (mostly functions) work as expected.
The primary goal of unit testing is to take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect.
Creating unit tests have many benefits, the most important one being that we can refactor the code and make sure that it still works as expected if the unit tests are still passing after the refactoring. Another one would be that you confirm the functionality of the function you created by testing it against expected AND unexpected input.