Add tests for initApp middleware

This adds tests for the `initApp` middleware.