Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript
1.1 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import { normalizeChannels } from '../src/services/directory/types.js'

describe('directory channel mappings', () => {
  it('normalizes all supported profile social channels', () => {
    expect(
      normalizeChannels({
        emails: [' [email protected] ', ''],
        telegramHandles: [' @testuser '],
        telegramIds: [' 123456789 '],
        slackUserNames: [' U123 '],
        discordUserNames: [' testuser '],
        whatsappNumbers: [' +15551234567 '],
      })
    ).toEqual({
      emails: ['[email protected]'],
      telegramHandles: ['@testuser'],
      telegramIds: ['123456789'],
      slackUserNames: ['U123'],
      discordUserNames: ['testuser'],
      whatsappNumbers: ['+15551234567'],
    })
  })

  it('fills missing new keys for existing profile records', () => {
    expect(normalizeChannels({ emails: ['[email protected]'], telegramIds: ['123'] })).toEqual({
      emails: ['[email protected]'],
      telegramHandles: [],
      telegramIds: ['123'],
      slackUserNames: [],
      discordUserNames: [],
      whatsappNumbers: [],
    })
  })
})