d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
/**
|
|
* @vitest-environment node
|
|
*/
|
|
import { describe, expect, it } from 'vitest'
|
|
import { vercelHandler } from '@/lib/webhooks/providers/vercel'
|
|
import { isVercelEventMatch } from '@/triggers/vercel/utils'
|
|
|
|
describe('isVercelEventMatch', () => {
|
|
it('matches specialized triggers to Vercel type strings', () => {
|
|
expect(isVercelEventMatch('vercel_deployment_created', 'deployment.created')).toBe(true)
|
|
expect(isVercelEventMatch('vercel_deployment_created', 'deployment.ready')).toBe(false)
|
|
})
|
|
|
|
it('does not match unknown trigger ids', () => {
|
|
expect(isVercelEventMatch('vercel_unknown_trigger', 'deployment.created')).toBe(false)
|
|
})
|
|
|
|
it('allows any event type for the curated generic trigger id', () => {
|
|
expect(isVercelEventMatch('vercel_webhook', 'deployment.succeeded')).toBe(true)
|
|
expect(isVercelEventMatch('vercel_webhook', undefined)).toBe(true)
|
|
})
|
|
})
|
|
|
|
describe('vercelHandler.formatInput', () => {
|
|
it('passes through documented deployment links, regions, meta, and domain.delegated', async () => {
|
|
const { input } = await vercelHandler.formatInput!({
|
|
webhook: {},
|
|
workflow: { id: 'w', userId: 'u' },
|
|
body: {
|
|
type: 'deployment.created',
|
|
id: 'evt_1',
|
|
createdAt: 1_700_000_000_000,
|
|
region: 'iad1',
|
|
payload: {
|
|
deployment: {
|
|
id: 'd1',
|
|
url: 'https://x.vercel.app',
|
|
name: 'x',
|
|
meta: { k: 'v' },
|
|
},
|
|
links: { deployment: 'https://vercel.com/d', project: 'https://vercel.com/p' },
|
|
regions: ['iad1', 'sfo1'],
|
|
domain: { name: 'example.com', delegated: true },
|
|
},
|
|
},
|
|
headers: {},
|
|
requestId: 't',
|
|
})
|
|
const i = input as Record<string, unknown>
|
|
expect(i.links).toEqual({
|
|
deployment: 'https://vercel.com/d',
|
|
project: 'https://vercel.com/p',
|
|
})
|
|
expect(i.regions).toEqual(['iad1', 'sfo1'])
|
|
expect(i.deployment).toMatchObject({
|
|
id: 'd1',
|
|
meta: { k: 'v' },
|
|
})
|
|
expect(i.domain).toMatchObject({ name: 'example.com', delegated: true })
|
|
})
|
|
})
|