chore: attach mongoMemoryServer to db and destroy in tests (#5326)
* chore: attach mongoMemoryServer to db and destroy in tests * bump mongodb-memory-server to 9.x --------- Co-authored-by: Paul Popus <paul@nouance.io>
This commit is contained in:
@@ -2,13 +2,13 @@ import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
import type { Payload } from '../../packages/payload/src/index.js'
|
||||
|
||||
import { getPayload } from '../../packages/payload/src/index.js'
|
||||
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
|
||||
import removeFiles from '../helpers/removeFiles.js'
|
||||
import { startMemoryDB } from '../startMemoryDB.js'
|
||||
import configPromise from './config.js'
|
||||
import { mediaSlug } from './shared.js'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
|
||||
@@ -48,6 +48,12 @@ describe('@payloadcms/plugin-seo', () => {
|
||||
})
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (typeof payload.db.destroy === 'function') {
|
||||
await payload.db.destroy()
|
||||
}
|
||||
})
|
||||
|
||||
it('should add meta title', async () => {
|
||||
const pageWithTitle = await payload.update({
|
||||
collection: 'pages',
|
||||
|
||||
Reference in New Issue
Block a user