690514:2019 204-rfa-approval-refactor #01
CI / CD Pipeline / build (push) Successful in 6m1s
CI / CD Pipeline / deploy (push) Failing after 6m42s

This commit is contained in:
2026-05-14 20:19:21 +07:00
parent 07cc6d47b1
commit 0240d80da5
183 changed files with 20050 additions and 1017 deletions
@@ -0,0 +1,63 @@
// File: frontend/components/response-code/ResponseCodeSelector.test.tsx
// Unit tests สำหรับ ResponseCodeSelector component (T078)
import { render, screen } from '@testing-library/react';
import { vi } from 'vitest';
import { ResponseCodeSelector } from '@/components/response-code/ResponseCodeSelector';
vi.mock('@/hooks/use-response-codes', () => ({
useResponseCodesByDocType: vi.fn(() => ({
data: [
{
publicId: 'uuid-1',
code: '1A',
category: 'ENGINEERING',
descriptionEn: 'Approved — No Comments',
descriptionTh: 'ผ่าน — ไม่มีเงื่อนไข',
implications: {},
notifyRoles: [],
isActive: true,
isSystem: true,
},
{
publicId: 'uuid-2',
code: '2',
category: 'ENGINEERING',
descriptionEn: 'Approved with Comments',
descriptionTh: 'ผ่าน — มีเงื่อนไข',
implications: { affectsSchedule: true },
notifyRoles: ['CONTRACT_MANAGER'],
isActive: true,
isSystem: true,
},
],
isLoading: false,
})),
}));
describe('ResponseCodeSelector', () => {
it('renders the trigger with placeholder text', () => {
render(
<ResponseCodeSelector
documentTypeId={1}
value={undefined}
onChange={vi.fn()}
/>,
);
expect(screen.getByRole('combobox')).toBeTruthy();
expect(screen.getByText('Select Response Code...')).toBeTruthy();
});
it('renders a custom placeholder when provided', () => {
render(
<ResponseCodeSelector
documentTypeId={1}
value={undefined}
onChange={vi.fn()}
placeholder="Choose a response code"
/>,
);
expect(screen.getByText('Choose a response code')).toBeTruthy();
});
});