added mocked tests for middleware