AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { describe, expect, it } from 'vitest'
import { ApplicationEventName, buildMockEvent, SignUpEvent, summarizeApplicationEvent, UserIdentityProvider, UserSignedInEvent } from '../../src/index'
function signedInEvent(data: UserSignedInEvent['data']): UserSignedInEvent {
const mock = UserSignedInEvent.parse(buildMockEvent({ event: ApplicationEventName.USER_SIGNED_IN, platformId: 'platform-id' }))
return { ...mock, userEmail: '[email protected]', data }
}
function signedUpEvent(data: SignUpEvent['data']): SignUpEvent {
const mock = SignUpEvent.parse(buildMockEvent({ event: ApplicationEventName.USER_SIGNED_UP, platformId: 'platform-id' }))
return { ...mock, userEmail: '[email protected]', data }
}
describe('summarizes sign-in and sign-up rows with their method', () => {
it.each([
{ data: { method: UserIdentityProvider.EMAIL }, expected: 'User [email protected] signed in with email' },
{ data: { method: UserIdentityProvider.GOOGLE }, expected: 'User [email protected] signed in with Google' },
{ data: { method: UserIdentityProvider.SAML }, expected: 'User [email protected] signed in with SAML' },
{ data: {}, expected: 'User [email protected] signed in' },
])('describes a sign-in with $data as "$expected"', ({ data, expected }) => {
expect(summarizeApplicationEvent(signedInEvent(data))).toBe(expected)
})
it.each([
{ data: { method: UserIdentityProvider.GOOGLE, source: 'sso' as const }, expected: 'User [email protected] signed up with Google' },
{ data: { method: UserIdentityProvider.JWT, source: 'managed' as const }, expected: 'User [email protected] signed up with JWT' },
{ data: { source: 'sso' as const }, expected: 'User [email protected] signed up using email from sso' },
{ data: {}, expected: 'User [email protected] signed up' },
])('describes a sign-up with $data as "$expected"', ({ data, expected }) => {
expect(summarizeApplicationEvent(signedUpEvent(data))).toBe(expected)
})
})