feat: update package copy and admin control room
This commit is contained in:
47
resources/js/admin/mobile/lib/controlRoom.test.ts
Normal file
47
resources/js/admin/mobile/lib/controlRoom.test.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { normalizeLiveStatus, resolveLiveShowApproveMode, resolveStatusTone } from './controlRoom';
|
||||
|
||||
describe('normalizeLiveStatus', () => {
|
||||
it('maps nullish statuses to none', () => {
|
||||
expect(normalizeLiveStatus(null)).toBe('none');
|
||||
expect(normalizeLiveStatus(undefined)).toBe('none');
|
||||
expect(normalizeLiveStatus('')).toBe('none');
|
||||
});
|
||||
|
||||
it('passes through supported statuses', () => {
|
||||
expect(normalizeLiveStatus('pending')).toBe('pending');
|
||||
expect(normalizeLiveStatus('approved')).toBe('approved');
|
||||
expect(normalizeLiveStatus('rejected')).toBe('rejected');
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveLiveShowApproveMode', () => {
|
||||
it('prefers approve-and-live for pending gallery', () => {
|
||||
expect(resolveLiveShowApproveMode('pending')).toBe('approve-and-live');
|
||||
});
|
||||
|
||||
it('returns approve-only for approved gallery', () => {
|
||||
expect(resolveLiveShowApproveMode('approved')).toBe('approve-only');
|
||||
});
|
||||
|
||||
it('returns not-eligible for rejected or hidden gallery', () => {
|
||||
expect(resolveLiveShowApproveMode('rejected')).toBe('not-eligible');
|
||||
expect(resolveLiveShowApproveMode('hidden')).toBe('not-eligible');
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveStatusTone', () => {
|
||||
it('maps approved to success', () => {
|
||||
expect(resolveStatusTone('approved')).toBe('success');
|
||||
});
|
||||
|
||||
it('maps pending to warning', () => {
|
||||
expect(resolveStatusTone('pending')).toBe('warning');
|
||||
});
|
||||
|
||||
it('maps other statuses to muted', () => {
|
||||
expect(resolveStatusTone('rejected')).toBe('muted');
|
||||
expect(resolveStatusTone('hidden')).toBe('muted');
|
||||
expect(resolveStatusTone(undefined)).toBe('muted');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user