fix: remove any types and unused variables in test file
- Replace 'any' types with proper TypeScript types (unknown, jest.Mock, Record) - Remove unused 'container' destructuring variable - Use document.querySelector instead of container.querySelector - Fixes ESLint errors: @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars Co-authored-by: CyberClaw <noreply@openclaw.ai>
This commit is contained in:
@@ -16,7 +16,7 @@ describe('GroupRectNode - Collapse/Expand', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks()
|
vi.clearAllMocks()
|
||||||
;(useCanvasStore as any).mockImplementation((selector: any) => {
|
;(useCanvasStore as unknown as jest.Mock).mockImplementation((selector: (state: Record<string, unknown>) => unknown) => {
|
||||||
const state = {
|
const state = {
|
||||||
setEditingGroupRectId: vi.fn(),
|
setEditingGroupRectId: vi.fn(),
|
||||||
toggleNodeCollapsed: mockToggle,
|
toggleNodeCollapsed: mockToggle,
|
||||||
@@ -51,11 +51,11 @@ describe('GroupRectNode - Collapse/Expand', () => {
|
|||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
}
|
}
|
||||||
|
|
||||||
const { container } = render(
|
render(
|
||||||
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
||||||
)
|
)
|
||||||
|
|
||||||
const btn = container.querySelector('button')
|
const btn = document.querySelector('button')
|
||||||
expect(btn).toBeTruthy()
|
expect(btn).toBeTruthy()
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -72,11 +72,11 @@ describe('GroupRectNode - Collapse/Expand', () => {
|
|||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
}
|
}
|
||||||
|
|
||||||
const { container } = render(
|
render(
|
||||||
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
||||||
)
|
)
|
||||||
|
|
||||||
const btn = container.querySelector('button')
|
const btn = document.querySelector('button')
|
||||||
expect(btn?.style.transform).toContain('rotate(-90deg)')
|
expect(btn?.style.transform).toContain('rotate(-90deg)')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -88,11 +88,11 @@ describe('GroupRectNode - Collapse/Expand', () => {
|
|||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
}
|
}
|
||||||
|
|
||||||
const { container } = render(
|
render(
|
||||||
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
||||||
)
|
)
|
||||||
|
|
||||||
const btn = container.querySelector('button')
|
const btn = document.querySelector('button')
|
||||||
if (btn) {
|
if (btn) {
|
||||||
await user.click(btn)
|
await user.click(btn)
|
||||||
expect(mockToggle).toHaveBeenCalledWith('zone-1')
|
expect(mockToggle).toHaveBeenCalledWith('zone-1')
|
||||||
@@ -112,7 +112,7 @@ describe('GroupRectNode - Collapse/Expand', () => {
|
|||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
}
|
}
|
||||||
|
|
||||||
const { container } = render(
|
render(
|
||||||
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -132,11 +132,11 @@ describe('GroupRectNode - Collapse/Expand', () => {
|
|||||||
position: { x: 0, y: 0 },
|
position: { x: 0, y: 0 },
|
||||||
}
|
}
|
||||||
|
|
||||||
const { container } = render(
|
render(
|
||||||
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
<GroupRectNode id={node.id} data={node.data} selected={false} isConnecting={false} xPos={0} yPos={0} />
|
||||||
)
|
)
|
||||||
|
|
||||||
const div = container.querySelector('div')
|
const div = document.querySelector('div')
|
||||||
expect(div?.style.opacity).toBe('0.6')
|
expect(div?.style.opacity).toBe('0.6')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user