Created tests for middleware