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/meService.js'

describe('meService 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('keeps existing records compatible when new keys are absent', () => {
    expect(normalizeChannels({ emails: ['[email protected]'], slackUserNames: ['slack'] })).toEqual({
      emails: ['[email protected]'],
      telegramHandles: [],
      telegramIds: [],
      slackUserNames: ['slack'],
      discordUserNames: [],
      whatsappNumbers: [],
    })
  })
})