Files
portal/app/tests/Frontend/useStatusPill.spec.ts
T

57 lines
2.4 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { useStatusPill, STATUS_PILL_SLUGS } from '../../resources/js/composables/useStatusPill';
describe('useStatusPill', () => {
it('exposes exactly 16 known slugs', () => {
expect(STATUS_PILL_SLUGS).toHaveLength(16);
expect(STATUS_PILL_SLUGS).toEqual(
expect.arrayContaining([
'new',
'viewed',
'in_progress',
'callback',
'quality',
'meeting_set',
'won',
'lost',
'refund',
'duplicate',
'junk',
'no_answer',
'cancelled',
'closed',
'postponed',
'archived',
]),
);
});
it.each([
['new', { bg: 'rgba(15,110,86,0.12)', color: '#0F6E56' }],
['viewed', { bg: 'rgba(122,91,163,0.15)', color: '#7A5BA3' }],
['in_progress', { bg: 'rgba(63,124,149,0.12)', color: '#2A5A6E' }],
['callback', { bg: 'rgba(217,164,65,0.18)', color: '#A07820' }],
['quality', { bg: 'rgba(46,139,87,0.15)', color: '#2E8B57' }],
['meeting_set', { bg: 'rgba(122,91,163,0.15)', color: '#7A5BA3' }],
['won', { bg: 'rgba(46,139,87,0.22)', color: '#1F6940', fontWeight: 600 }],
['lost', { bg: 'rgba(107,99,86,0.18)', color: '#6B6356' }],
['refund', { bg: 'rgba(204,110,80,0.15)', color: '#B0563D' }],
['duplicate', { bg: 'rgba(1,32,25,0.08)', color: '#3A3A3A' }],
['junk', { bg: 'rgba(184,58,58,0.10)', color: '#B83A3A' }],
['no_answer', { bg: 'rgba(107,99,86,0.15)', color: '#6B6356' }],
['cancelled', { bg: 'rgba(107,99,86,0.18)', color: '#6B6356', textDecoration: 'line-through' }],
['closed', { bg: 'rgba(1,32,25,0.10)', color: '#3A3A3A' }],
['postponed', { bg: 'rgba(15,110,86,0.06)', color: '#6B6356' }],
['archived', { bg: '#012019', color: '#E8E2D4' }],
])('returns correct tokens for %s', (slug, expected) => {
const result = useStatusPill(slug);
expect(result).toMatchObject(expected);
});
it('falls back to a neutral style for unknown slug', () => {
const result = useStatusPill('unknown_slug');
expect(result.bg).toMatch(/rgba\(1, ?32, ?25/);
expect(result.color).toBeDefined();
});
});