Unit Testing with Jest for Strapi v4

The issue you get is due to the missing permissions for your /api/hello endpoint.
You can inject them in your database during the bootstrap phase like it is made in the templates: https://github.com/strapi/starters-and-templates/blob/main/packages/templates/blog/template/src/bootstrap.js#L174-L180

Or you can also try config-sync with importOnBootstrap: true option https://github.com/boazpoolman/strapi-plugin-config-sync

Hope this helps!

1 Like