tests for error middleware