refactored test case for on/off toggle