test: passing text field suite (#5341)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { MongooseAdapter } from 'packages/db-mongodb/src/index.js'
|
||||
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
@@ -9,12 +11,12 @@ import { createSnapshot, dbSnapshot, restoreFromSnapshot } from './snapshot.js'
|
||||
type SeedFunction = (_payload: Payload) => Promise<void>
|
||||
|
||||
export async function seedDB({
|
||||
shouldResetDB,
|
||||
_payload,
|
||||
snapshotKey,
|
||||
seedFunction,
|
||||
uploadsDir,
|
||||
collectionSlugs,
|
||||
seedFunction,
|
||||
shouldResetDB,
|
||||
snapshotKey,
|
||||
uploadsDir,
|
||||
}: {
|
||||
_payload: Payload
|
||||
collectionSlugs: string[]
|
||||
@@ -71,9 +73,10 @@ export async function seedDB({
|
||||
// Dropping the db breaks indexes (on mongoose - did not test extensively on postgres yet), so we recreate them here
|
||||
if (shouldResetDB) {
|
||||
if (isMongoose(_payload)) {
|
||||
const db = _payload.db as MongooseAdapter
|
||||
await Promise.all([
|
||||
...collectionSlugs.map(async (collectionSlug) => {
|
||||
await _payload.db.collections[collectionSlug].createIndexes()
|
||||
Object.entries(db.collections).map(async ([_, collection]) => {
|
||||
await collection.createIndexes()
|
||||
}),
|
||||
])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user