Add conditional branches for unit testing

This commit adds conditional logic for running unit tests.