071faa482c
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
/* @vitest-environment jsdom */
|
|
|
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
import { expect, test, vi } from 'vitest';
|
|
|
|
import { PlatformDraftGenerationPointNoticeDialog } from './PlatformDraftGenerationPointNoticeDialog';
|
|
|
|
test('renders the insufficient-points notice with the shared blocking copy', () => {
|
|
const onClose = vi.fn();
|
|
|
|
render(
|
|
<PlatformDraftGenerationPointNoticeDialog
|
|
notice={{
|
|
kind: 'insufficient-points',
|
|
requiredPoints: 30,
|
|
currentPoints: 12,
|
|
}}
|
|
onClose={onClose}
|
|
/>,
|
|
);
|
|
|
|
expect(screen.getByRole('dialog', { name: '泥点不足' })).toBeTruthy();
|
|
expect(screen.getByText('本次需要 30 泥点,当前 12 泥点。')).toBeTruthy();
|
|
expect(
|
|
screen.getByText('当前表单不会丢失,关闭后可继续编辑或补足泥点再继续。'),
|
|
).toBeTruthy();
|
|
|
|
fireEvent.click(screen.getByRole('button', { name: '知道了' }));
|
|
expect(onClose).toHaveBeenCalledTimes(1);
|
|
});
|
|
|
|
test('renders the balance-load-failed notice without the amber icon override', () => {
|
|
render(
|
|
<PlatformDraftGenerationPointNoticeDialog
|
|
notice={{ kind: 'balance-load-failed' }}
|
|
onClose={() => {}}
|
|
/>,
|
|
);
|
|
|
|
const dialog = screen.getByRole('dialog', { name: '读取泥点余额失败' });
|
|
|
|
expect(screen.getByText('请稍后重试。')).toBeTruthy();
|
|
expect(
|
|
screen.getByText('当前表单不会丢失,关闭后可继续编辑,稍后再试。'),
|
|
).toBeTruthy();
|
|
expect(dialog.innerHTML).not.toContain('bg-amber-100/80');
|
|
});
|