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.

822 B
Raw Blame
import { describe, expect, it } from 'vitest'
import { type Place, placeFromHash } from './useContactsPage.ts'

const left: Place = { query: 'mi', searching: true, cursorId: 'a', openId: null }

describe('a link to one contact (C9)', () => {
  it('opens that contact and puts the cursor on it', () => {
    expect(placeFromHash(left, '#contacts/ct_9')).toEqual({
      ...left,
      cursorId: 'ct_9',
      openId: 'ct_9',
    })
  })
  it('keeps the place the page was left in for any other address', () => {
    expect(placeFromHash(left, '#contacts')).toBe(left)
    expect(placeFromHash(left, '#call/c1')).toBe(left)
    // The page's dialogs are not contacts (shell/dialogAddress.ts).
    expect(placeFromHash(left, '#contacts/new')).toBe(left)
    expect(placeFromHash(left, '#contacts/import')).toBe(left)
  })
})