Testing with a Postgres database

Hey @MCT,

You can do it like this in your afterAll function:

afterAll(async (done) => {
  await strapi.connections.default.raw(`DELETE FROM categories;`);
  done();
});

That’s how I prefer to do it. But you can also use the service for that:

await strapi.services['category'].delete({ id:category.id });

1 Like