Files
payloadcms/test/plugin-stripe/int.spec.ts
Alessio Gravili 7c05c775cb docs: improve jobs autorun docs, adds e2e test (#12196)
This clarifies that jobs.autoRun only *runs* already-queued jobs. It does not queue the jobs for you.

Also adds an e2e test as this functionality had no e2e coverage
2025-06-05 09:19:19 -07:00

46 lines
1.2 KiB
TypeScript

import type { Payload } from 'payload'
import path from 'path'
import { fileURLToPath } from 'url'
import { initPayloadInt } from '../helpers/initPayloadInt.js'
let payload: Payload
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
describe('Stripe Plugin', () => {
beforeAll(async () => {
;({ payload } = await initPayloadInt(dirname))
})
afterAll(async () => {
await payload.destroy()
})
it('should create products', async () => {
const product = await payload.create({
collection: 'products',
data: {
name: 'Test Product',
},
})
expect(product).toHaveProperty('name', 'Test Product')
})
// Test various common API calls like `products.create`, etc.
// Send the requests through the Payload->Stripe proxy
// Query Stripe directly to ensure the data is as expected
it.todo('should open REST API proxy')
// Test various common webhook events like `product.created`, etc.
// These could potentially be mocked
it.todo('should handle incoming Stripe webhook events')
// Test that the data is synced to Stripe automatically without the use of custom hooks/proxy
// I.e. the `sync` config option
it.todo('should auto-sync data based on config')
})