test: refactor int tests to use initPayloadInt which reduces boilerplate

This commit is contained in:
Elliot DeNolf
2024-03-16 10:11:00 -04:00
parent ef141d499b
commit 14eb66c87d
52 changed files with 103 additions and 259 deletions

View File

@@ -1,11 +1,10 @@
import type { Payload } from '../../packages/payload/src/index.js'
import type { NextRESTClient } from '../helpers/NextRESTClient.js'
import type { NestedAfterReadHook } from './payload-types.js'
import { AuthenticationError } from '../../packages/payload/src/errors/index.js'
import { getPayload } from '../../packages/payload/src/index.js'
import { devUser, regularUser } from '../credentials.js'
import { NextRESTClient } from '../helpers/NextRESTClient.js'
import { startMemoryDB } from '../startMemoryDB.js'
import { initPayloadInt } from '../helpers/initPayloadInt.js'
import { afterOperationSlug } from './collections/AfterOperation/index.js'
import { chainingHooksSlug } from './collections/ChainingHooks/index.js'
import { contextHooksSlug } from './collections/ContextHooks/index.js'
@@ -26,9 +25,7 @@ let payload: Payload
describe('Hooks', () => {
beforeAll(async () => {
const config = await startMemoryDB(configPromise)
payload = await getPayload({ config })
restClient = new NextRESTClient(payload.config)
;({ payload, restClient } = await initPayloadInt(configPromise))
})
afterAll(async () => {