Add tests to expose incorrect behaviour

Check for state in error redirects.