Added middleware tests