diff --git a/tests-ui/tests/renderer/extensions/vueNodes/components/ImagePreview.test.ts b/tests-ui/tests/renderer/extensions/vueNodes/components/ImagePreview.test.ts index d38ea0b8e..583bc1856 100644 --- a/tests-ui/tests/renderer/extensions/vueNodes/components/ImagePreview.test.ts +++ b/tests-ui/tests/renderer/extensions/vueNodes/components/ImagePreview.test.ts @@ -1,6 +1,7 @@ import { createTestingPinia } from '@pinia/testing' +import type { VueWrapper } from '@vue/test-utils' import { mount } from '@vue/test-utils' -import { describe, expect, it, vi } from 'vitest' +import { afterEach, describe, expect, it, vi } from 'vitest' import { nextTick } from 'vue' import { createI18n } from 'vue-i18n' @@ -41,9 +42,10 @@ describe('ImagePreview', () => { '/api/view?filename=test2.png&type=output' ] } + const wrapperRegistry = new Set() const mountImagePreview = (props = {}) => { - return mount(ImagePreview, { + const wrapper = mount(ImagePreview, { props: { ...defaultProps, ...props }, global: { plugins: [ @@ -61,8 +63,17 @@ describe('ImagePreview', () => { } } }) + wrapperRegistry.add(wrapper) + return wrapper } + afterEach(() => { + wrapperRegistry.forEach((wrapper) => { + wrapper.unmount() + }) + wrapperRegistry.clear() + }) + it('renders image preview when imageUrls provided', () => { const wrapper = mountImagePreview()