refactored the tests to use a variable to reduce code duplication