added tests for midleware module