add tests for the middleware