Improved tests for jobs and apps middlewares.