Add test cases for redirecting with state.