mirror of
https://github.com/strapi/strapi.git
synced 2025-11-08 22:32:02 +00:00
test(api): cleanup test data (#22760)
* test(api): cleanup test data * test(api): do not delete products in afterAll
This commit is contained in:
parent
88f5d2bfb3
commit
0954e210a1
@ -45,14 +45,16 @@ describe('CRUD locales', () => {
|
|||||||
rq = await createAuthRequest({ strapi });
|
rq = await createAuthRequest({ strapi });
|
||||||
|
|
||||||
localeService = strapi.plugin('i18n').service('locales');
|
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 () => {
|
afterAll(async () => {
|
||||||
await localeService.setDefaultLocale({ code: 'en' });
|
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.db.query('plugin::i18n.locale').deleteMany({ code: { $ne: 'en' } });
|
||||||
|
|
||||||
await strapi.destroy();
|
await strapi.destroy();
|
||||||
await builder.cleanup();
|
await builder.cleanup();
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user