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:
@@ -1,11 +1,9 @@
|
||||
import type { Payload } from '../../packages/payload/src/index.js'
|
||||
|
||||
import { getPayload } from '../../packages/payload/src/index.js'
|
||||
import { devUser } from '../credentials.js'
|
||||
import { NextRESTClient } from '../helpers/NextRESTClient.js'
|
||||
import { startMemoryDB } from '../startMemoryDB.js'
|
||||
import configPromise from './config.js'
|
||||
import { postDoc } from './config.js'
|
||||
import configPromise, { postDoc } from './config.js'
|
||||
|
||||
let restClient: NextRESTClient
|
||||
let payload: Payload
|
||||
@@ -28,6 +26,12 @@ describe('dataloader', () => {
|
||||
if (loginResult.token) token = loginResult.token
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
if (typeof payload.db.destroy === 'function') {
|
||||
await payload.db.destroy()
|
||||
}
|
||||
})
|
||||
|
||||
describe('graphql', () => {
|
||||
it('should allow querying via graphql', async () => {
|
||||
const query = `query {
|
||||
|
||||
Reference in New Issue
Block a user