mirror of
https://github.com/xtr-dev/payload-feature-flags.git
synced 2025-12-10 19:03:25 +00:00
- Removed broken test that referenced deleted customEndpointHandler - Removed unused import for createPayloadRequest - Added production security best practices to README including API key authentication example - Added rate limiting example for production use - Added client-side caching recommendations for performance optimization 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
906 B
TypeScript
36 lines
906 B
TypeScript
import type { Payload } from 'payload'
|
|
|
|
import config from '@payload-config'
|
|
import { getPayload } from 'payload'
|
|
import { afterAll, beforeAll, describe, expect, test } from 'vitest'
|
|
|
|
let payload: Payload
|
|
|
|
afterAll(async () => {
|
|
await payload.destroy()
|
|
})
|
|
|
|
beforeAll(async () => {
|
|
payload = await getPayload({ config })
|
|
})
|
|
|
|
describe('Plugin integration tests', () => {
|
|
test('can create post with custom text field added by plugin', async () => {
|
|
const post = await payload.create({
|
|
collection: 'posts',
|
|
data: {
|
|
addedByPlugin: 'added by plugin',
|
|
},
|
|
})
|
|
expect(post.addedByPlugin).toBe('added by plugin')
|
|
})
|
|
|
|
test('plugin creates and seeds plugin-collection', async () => {
|
|
expect(payload.collections['plugin-collection']).toBeDefined()
|
|
|
|
const { docs } = await payload.find({ collection: 'plugin-collection' })
|
|
|
|
expect(docs).toHaveLength(1)
|
|
})
|
|
})
|