added middleware tests