add middleware tests