Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

906 B
Raw Blame
import { describe, expect, it } from 'vitest'
import { changedFields } from './brandChanges.ts'

const brand = {
  name: 'Northside Voice',
  logoUrl: '/logo/1.png',
  supportEmail: '[email protected]',
  termsUrl: 'https://northside.example/terms',
  privacyUrl: null,
}

describe('brand changes to review', () => {
  it('names only the reviewed fields that differ from the approved brand', () => {
    expect(changedFields(brand, brand)).toEqual([])
    expect(changedFields({ ...brand, supportEmail: '[email protected]' }, brand)).toEqual(['supportEmail'])
    expect(changedFields({ ...brand, logoUrl: '/logo/2.png', privacyUrl: 'https://northside.example/p' }, brand)).toEqual(
      ['logo', 'privacyUrl'],
    )
  })

  it('names every field set when nothing is approved yet', () => {
    expect(changedFields(brand, null)).toEqual(['name', 'logo', 'supportEmail', 'termsUrl'])
  })
})