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

@@ -3,10 +3,9 @@ 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 { initPayloadInt } from '../helpers/initPayloadInt.js'
import removeFiles from '../helpers/removeFiles.js'
import { startMemoryDB } from '../startMemoryDB.js'
import configPromise from './config.js'
import { mediaSlug } from './shared.js'
@@ -22,9 +21,7 @@ describe('@payloadcms/plugin-seo', () => {
beforeAll(async () => {
const uploadsDir = path.resolve(dirname, './media')
removeFiles(path.normalize(uploadsDir))
const config = await startMemoryDB(configPromise)
payload = await getPayload({ config })
;({ payload } = await initPayloadInt(configPromise))
// Create image
const filePath = path.resolve(dirname, './image-1.jpg')

View File

@@ -85,15 +85,3 @@ export interface PayloadMigration {
updatedAt: string
createdAt: string
}
declare module 'payload' {
export interface GeneratedTypes {
collections: {
users: User
pages: Page
media: Media
'payload-preferences': PayloadPreference
'payload-migrations': PayloadMigration
}
}
}