更新描述文档;

修复了若干错误;
This commit is contained in:
2025-10-05 02:26:50 +08:00
parent d70e9e62b8
commit e30e5b4fe2
13 changed files with 229 additions and 312 deletions

View File

@@ -5,12 +5,12 @@ import { useAppStore } from '../store/useAppStore';
// Mock Konva components
jest.mock('react-konva', () => ({
Stage: ({ children, ...props }: any) => (
Stage: ({ children, ...props }: { children: React.ReactNode; [key: string]: unknown }) => (
<div data-testid="konva-stage" {...props}>
{children}
</div>
),
Layer: ({ children }: any) => <div data-testid="konva-layer">{children}</div>,
Layer: ({ children }: { children: React.ReactNode }) => <div data-testid="konva-layer">{children}</div>,
Image: () => <div data-testid="konva-image" />,
Line: () => <div data-testid="konva-line" />
}));
@@ -33,7 +33,7 @@ jest.mock('../components/ToastContext', () => ({
describe('ImageCanvas', () => {
beforeEach(() => {
// Reset the store
const store: any = useAppStore;
const store = useAppStore as unknown as { setState: (state: unknown) => void };
store.setState({
canvasImage: null,
canvasZoom: 1,
@@ -61,7 +61,7 @@ describe('ImageCanvas', () => {
it('should render generation overlay when generating', () => {
// Set the store to generating state
const store: any = useAppStore;
const store = useAppStore as unknown as { setState: (state: unknown) => void };
store.setState({
isGenerating: true
});
@@ -74,7 +74,7 @@ describe('ImageCanvas', () => {
it('should show retry count during continuous generation', () => {
// Set the store to continuous generation state
const store: any = useAppStore;
const store = useAppStore as unknown as { setState: (state: unknown) => void };
store.setState({
isGenerating: true,
isContinuousGenerating: true,
@@ -89,7 +89,7 @@ describe('ImageCanvas', () => {
it('should render canvas controls when image is present', () => {
// Set the store to have an image and not generating
const store: any = useAppStore;
const store = useAppStore as unknown as { setState: (state: unknown) => void };
store.setState({
canvasImage: 'test-image-url',
isGenerating: false
@@ -107,7 +107,7 @@ describe('ImageCanvas', () => {
describe('continuous generation display', () => {
it('should display retry count in generation overlay', () => {
// Set the store to continuous generation state
const store: any = useAppStore;
const store = useAppStore as unknown as { setState: (state: unknown) => void };
store.setState({
isGenerating: true,
isContinuousGenerating: true,
@@ -122,7 +122,7 @@ describe('ImageCanvas', () => {
it('should not display retry count when not in continuous mode', () => {
// Set the store to regular generation state
const store: any = useAppStore;
const store = useAppStore as unknown as { setState: (state: unknown) => void };
store.setState({
isGenerating: true,
isContinuousGenerating: false,