Updated tests for middleware