test(api): cleanup test data (#22760)

* test(api): cleanup test data

* test(api): do not delete products in afterAll
This commit is contained in:
Ben Irvin 2025-01-31 12:31:36 +01:00 committed by GitHub
parent 88f5d2bfb3
commit 0954e210a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,14 +45,16 @@ describe('CRUD locales', () => {
rq = await createAuthRequest({ strapi });
localeService = strapi.plugin('i18n').service('locales');
// ensure we don't have any data in the database left over from previous tests that didn't clean up
await strapi.db.query('api::product.product').deleteMany();
});
afterAll(async () => {
await localeService.setDefaultLocale({ code: 'en' });
// Delete all locales that have been created
// Delete all data that has been created
await strapi.db.query('plugin::i18n.locale').deleteMany({ code: { $ne: 'en' } });
await strapi.destroy();
await builder.cleanup();
});