690615:1550 237 #01.2
This commit is contained in:
@@ -1,11 +1,16 @@
|
|||||||
// File: frontend/components/admin/ai/__tests__/prompt-type-dropdown.test.tsx
|
// File: frontend/components/admin/ai/__tests__/prompt-type-dropdown.test.tsx
|
||||||
// Change Log:
|
// Change Log:
|
||||||
// - 2026-06-14: สร้างใหม่สำหรับ Phase 3 Coverage
|
// - 2026-06-14: สร้างใหม่สำหรับ Phase 3 Coverage
|
||||||
|
// - 2026-06-15: เพิ่ม i18n mock เพื่อแก้ไข test failure
|
||||||
|
|
||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
import PromptTypeDropdown from '../PromptTypeDropdown';
|
import PromptTypeDropdown from '../PromptTypeDropdown';
|
||||||
|
|
||||||
|
vi.mock('@/hooks/use-translations', () => ({
|
||||||
|
useTranslations: () => (key: string) => key,
|
||||||
|
}));
|
||||||
|
|
||||||
describe('PromptTypeDropdown', () => {
|
describe('PromptTypeDropdown', () => {
|
||||||
it('ควร render dropdown สำหรับเลือกประเภทพรอมต์', () => {
|
it('ควร render dropdown สำหรับเลือกประเภทพรอมต์', () => {
|
||||||
const handleChange = vi.fn();
|
const handleChange = vi.fn();
|
||||||
@@ -16,7 +21,7 @@ describe('PromptTypeDropdown', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText('ประเภทของพรอมต์ (Prompt Type)')).toBeInTheDocument();
|
expect(screen.getByText('prompt_management.prompt_type')).toBeInTheDocument();
|
||||||
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
expect(screen.getByRole('combobox')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
// File: frontend/components/admin/ai/__tests__/version-history.test.tsx
|
// File: frontend/components/admin/ai/__tests__/version-history.test.tsx
|
||||||
// Change Log:
|
// Change Log:
|
||||||
// - 2026-06-14: สร้างใหม่สำหรับ Phase 3 Coverage
|
// - 2026-06-14: สร้างใหม่สำหรับ Phase 3 Coverage
|
||||||
|
// - 2026-06-15: เพิ่ม i18n mock เพื่อแก้ไข test failure
|
||||||
|
|
||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
import VersionHistory from '../VersionHistory';
|
import VersionHistory from '../VersionHistory';
|
||||||
|
|
||||||
|
vi.mock('@/hooks/use-translations', () => ({
|
||||||
|
useTranslations: () => (key: string) => key,
|
||||||
|
}));
|
||||||
|
|
||||||
describe('VersionHistory', () => {
|
describe('VersionHistory', () => {
|
||||||
const mockVersions = [
|
const mockVersions = [
|
||||||
{
|
{
|
||||||
@@ -30,7 +35,7 @@ describe('VersionHistory', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText('กำลังโหลดประวัติเวอร์ชัน...')).toBeInTheDocument();
|
expect(screen.getByText((content) => content.includes('prompt_management.version_history'))).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ควร render empty state เมื่อไม่มีเวอร์ชัน', () => {
|
it('ควร render empty state เมื่อไม่มีเวอร์ชัน', () => {
|
||||||
@@ -46,7 +51,7 @@ describe('VersionHistory', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByText('ไม่พบเวอร์ชันอื่นในระบบสำหรับประเภทนี้')).toBeInTheDocument();
|
expect(screen.getByText('prompt_management.no_versions')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('ควร render รายการเวอร์ชัน', () => {
|
it('ควร render รายการเวอร์ชัน', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user