Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1m13s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 6s
Server / Tests (frappe ${{ matrix.frappe-branch }}) (push) Has been skipped
Server / Resolve frappe matrix (push) Failing after 1s
Frontend / Lint (push) Failing after 1s
Frontend / Production Build (push) Failing after 1s
Server / Coverage Wrap Up (push) Has been skipped
Frontend / Coverage Wrap Up (push) Has been skipped
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
// callLog.js pulls in unrelated heavy dependencies (icon-resolving imports,
|
|
// a live createResource network call) that aren't wired up for vitest —
|
|
// stub them so this test exercises only getCallStatusLabel's pure logic.
|
|
vi.mock('@/utils', () => ({ formatDate: vi.fn() }))
|
|
vi.mock('@/stores/meta', () => ({
|
|
getMeta: () => ({
|
|
getFormattedPercent: vi.fn(),
|
|
getFormattedFloat: vi.fn(),
|
|
getFormattedCurrency: vi.fn(),
|
|
}),
|
|
}))
|
|
vi.mock('@/composables/useTimelinePreferences', () => ({
|
|
timestampCell: vi.fn(),
|
|
}))
|
|
|
|
import { getCallStatusLabel } from '@/utils/callLog'
|
|
|
|
describe('getCallStatusLabel', () => {
|
|
it('labels an unanswered incoming call as Missed Call', () => {
|
|
expect(getCallStatusLabel('No Answer', 'Incoming')).toBe('Missed Call')
|
|
})
|
|
|
|
it('labels an unanswered outgoing call as No Answer', () => {
|
|
expect(getCallStatusLabel('No Answer', 'Outgoing')).toBe('No Answer')
|
|
})
|
|
|
|
it('falls back to No Answer when call type is missing', () => {
|
|
expect(getCallStatusLabel('No Answer', undefined)).toBe('No Answer')
|
|
})
|
|
|
|
it('leaves other statuses unaffected by call type', () => {
|
|
expect(getCallStatusLabel('Completed', 'Incoming')).toBe('Completed')
|
|
expect(getCallStatusLabel('Completed', 'Outgoing')).toBe('Completed')
|
|
})
|
|
})
|