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
46 lines
1.2 KiB
TypeScript
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')
|
|
})
|