feat: update user roles and passwords in QA driver, enhance documentation with error codes, and improve trial activation error handling
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { STATUS_META } from './AppointmentStatusDropdown';
|
||||
|
||||
/**
|
||||
* Mirrors Appointment::STATUS_* on the backend. The dashboard used to keep its
|
||||
* own copy of this map, which drifted and rendered `confirmed` / `expired` as
|
||||
* raw English; every consumer now derives from STATUS_META, so this list is the
|
||||
* one place that has to stay in sync with the entity.
|
||||
*/
|
||||
const BACKEND_STATUSES = [
|
||||
'pending',
|
||||
'confirmed',
|
||||
'completed',
|
||||
'cancelled_by_doctor',
|
||||
'cancelled_by_user',
|
||||
'expired',
|
||||
'no_show',
|
||||
'following_up',
|
||||
'salon',
|
||||
] as const;
|
||||
|
||||
describe('STATUS_META', () => {
|
||||
it.each(BACKEND_STATUSES)('has a Persian label and colour for %s', (status) => {
|
||||
expect(STATUS_META[status]).toBeDefined();
|
||||
expect(STATUS_META[status].label.trim()).not.toBe('');
|
||||
expect(STATUS_META[status].color).toMatch(/^#[0-9a-f]{6}$/i);
|
||||
});
|
||||
|
||||
it('carries no label that is still English', () => {
|
||||
const latin = Object.entries(STATUS_META)
|
||||
.filter(([, v]) => /[A-Za-z]/.test(v.label))
|
||||
.map(([k]) => k);
|
||||
expect(latin).toEqual([]);
|
||||
});
|
||||
|
||||
it('defines no status the backend does not know about', () => {
|
||||
const unknown = Object.keys(STATUS_META).filter(
|
||||
(k) => !BACKEND_STATUSES.includes(k as (typeof BACKEND_STATUSES)[number]),
|
||||
);
|
||||
expect(unknown).toEqual([]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user