From 160f285fef2b8d19cb49fac2ef9c0bf050dbc7b6 Mon Sep 17 00:00:00 2001 From: Nicolas Bonamy Date: Mon, 30 Dec 2024 18:49:52 -0400 Subject: [PATCH] test fix --- src/components/EmptyChat.vue | 6 ++++++ tests/components/empty_chat.test.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/EmptyChat.vue b/src/components/EmptyChat.vue index 9f29946..f295622 100644 --- a/src/components/EmptyChat.vue +++ b/src/components/EmptyChat.vue @@ -119,6 +119,8 @@ const onEngine = (engine: string) => { const animateEngineLogo = (srcSelector: string, dstSelector: string, callback: (progress: number) => void) => { + try { + const container = document.querySelector('.engines') const source = document.querySelector(srcSelector) const target = document.querySelector(dstSelector) @@ -134,6 +136,10 @@ const animateEngineLogo = (srcSelector: string, dstSelector: string, callback: ( const targetY = target.getBoundingClientRect().top moveElement(clone, targetX, targetY, 150, (progress) => callback({ container, source, target, clone }, progress)) + } catch (e) { + console.error(e) + } + } const moveElement = (element: HTMLElement, endX: number, endY: number, duration: number, callback: (progress: number) => void) => { diff --git a/tests/components/empty_chat.test.ts b/tests/components/empty_chat.test.ts index a3329c5..368d349 100644 --- a/tests/components/empty_chat.test.ts +++ b/tests/components/empty_chat.test.ts @@ -73,7 +73,7 @@ test('Renders correctly', async () => { test('Renders engines and models', async () => { const wrapper: VueWrapper = mount(EmptyChat) - expect(wrapper.findAllComponents(EngineLogo).length).toBe(availableEngines.length) + expect(wrapper.findAllComponents(EngineLogo).length).toBe(availableEngines.length+1) expect(wrapper.findAll('.empty select option')).toHaveLength(3) })