Skip to content

Instantly share code, notes, and snippets.

@qunabu
Created October 15, 2020 19:00
Show Gist options
  • Save qunabu/32e7cd40acde20eebc902a48e83de874 to your computer and use it in GitHub Desktop.
Save qunabu/32e7cd40acde20eebc902a48e83de874 to your computer and use it in GitHub Desktop.
it("should return `Hi ${user.username}`", async (done) => {
const token = await jwt(user.id);
await request(strapi.server) // app server is and instance of Class: http.Server
.get("/hi")
.set("Authorization", "Bearer " + token)
.expect(200) // Expect response http code 200
.then((data) => {
expect(data.text).toBe(`Hi ${user.username}`); // expect the response welcome text
});
done();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment