Added tests for the middleware