refactor tests for new style middleware