From d7c20c69415ee1570dd4eef0121c36be9ce2049f Mon Sep 17 00:00:00 2001 From: James Date: Thu, 4 Apr 2024 10:11:45 -0400 Subject: [PATCH] chore: ensure indexes are created before running localization test suite --- test/localization/config.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/localization/config.ts b/test/localization/config.ts index 650eff9619..8172382cb2 100644 --- a/test/localization/config.ts +++ b/test/localization/config.ts @@ -281,6 +281,17 @@ export default buildConfigWithDefaults({ console.log('SEED BEGIN') + if (payload.db.name === 'mongoose') { + await new Promise((resolve, reject) => { + payload.db?.collections[localizedPostsSlug]?.ensureIndexes(function (err) { + if (err) reject(err) + resolve(true) + }) + }) + } + + console.log('INDEXES CREATED') + await payload.create({ collection, data: {