test: fix seed helper, was causing errors in versions suite

This commit is contained in:
Elliot DeNolf
2024-03-15 16:55:54 -04:00
parent 9226be058c
commit 04a3223ff5

View File

@@ -73,10 +73,9 @@ export async function seedDB({
// Dropping the db breaks indexes (on mongoose - did not test extensively on postgres yet), so we recreate them here // Dropping the db breaks indexes (on mongoose - did not test extensively on postgres yet), so we recreate them here
if (shouldResetDB) { if (shouldResetDB) {
if (isMongoose(_payload)) { if (isMongoose(_payload)) {
const db = _payload.db as MongooseAdapter
await Promise.all([ await Promise.all([
Object.entries(db.collections).map(async ([_, collection]) => { ...collectionSlugs.map(async (collectionSlug) => {
await collection.createIndexes() await _payload.db.collections[collectionSlug].createIndexes()
}), }),
]) ])
} }