Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(desktop): overload-safe createElement mock in ArtifactsBadge test

Miguelon Peluchon4c55bf7421a4
diff --git a/desktop-app/ui/src/components/__tests__/ArtifactsBadge.test.tsx b/desktop-app/ui/src/components/__tests__/ArtifactsBadge.test.tsx
index 32caee144..efbde8174 100644
--- a/desktop-app/ui/src/components/__tests__/ArtifactsBadge.test.tsx
+++ b/desktop-app/ui/src/components/__tests__/ArtifactsBadge.test.tsx
@@ -297,16 +297,17 @@ describe('ArtifactsBadge — download', () => {
// Mock the anchor element creation without infinite recursion
const origCreateElement = document.createElement.bind(document)
const clickSpy = vi.fn()
- vi.spyOn(document, 'createElement').mockImplementation(
- (tag: string, options?: ElementCreationOptions) => {
- if (tag === 'a') {
- const el = origCreateElement('a', options)
- el.click = clickSpy
- return el
- }
- return origCreateElement(tag, options)
+ vi.spyOn(document, 'createElement').mockImplementation(((
+ tag: string,
+ options?: ElementCreationOptions
+ ): HTMLElement => {
+ if (tag === 'a') {
+ const el = origCreateElement('a', options)
+ el.click = clickSpy
+ return el
}
- )
+ return origCreateElement(tag, options)
+ }) as typeof document.createElement)
render(<ArtifactsBadge hostRef="chatllm" />)