Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.3 KB
Raw Blame
import { describe, expect, it } from 'vitest'

import { GENERATED_TOOLS } from '@/tools/generated/data_catalog'

describe('data catalog confirmed actions', () => {
    it('accepts only confirmation fields when executing a signed rejection', () => {
        const executeSchema = GENERATED_TOOLS['data-catalog-relationship-reject-execute']!().schema
        const confirmation = {
            confirmation_hash: 'signed-token',
            confirmation: 'confirm',
        }

        expect(executeSchema.safeParse(confirmation).success).toBe(true)
        expect(
            executeSchema.safeParse({
                ...confirmation,
                id: 'proposal-id',
                rejection_reason: 'duplicate relationship',
            }).success
        ).toBe(false)
    })

    it('accepts only confirmation fields when executing a signed metric deletion', () => {
        const executeSchema = GENERATED_TOOLS['data-catalog-metric-delete-execute']!().schema
        const confirmation = {
            confirmation_hash: 'signed-token',
            confirmation: 'confirm',
        }

        expect(executeSchema.safeParse(confirmation).success).toBe(true)
        expect(
            executeSchema.safeParse({
                ...confirmation,
                name: 'weekly active users',
            }).success
        ).toBe(false)
    })
})