Answers for "Error: Forbidden testing strapi"

0

Error: Forbidden testing strapi

const request = require("supertest")
const { grantPrivilege } = require("./../helpers/strapi");

beforeAll(async () => {
  await grantPrivilege(2, "permissions.application.controllers.hello.index");  // Gives Public access to endpoint
});

it('should return hello world', async (done) => {
    await request(strapi.server) // app server is an instance of Class: http.Server
    .get('/hello')
    .expect(200) // Expect response http code 200
    .then((data) => {
      expect(data.text).toBe('Hello World!') // expect the response text
    })
  done()
})
Posted by: Guest on May-26-2021

Code answers related to "Error: Forbidden testing strapi"

Code answers related to "ActionScript"

Browse Popular Code Answers by Language