Refactor test to use ternary operator as function call argument