Skip to content

Commit

Permalink
enableAutoUnmount on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nbonamy committed May 17, 2024
1 parent 0f4aebb commit 3d24077
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
6 changes: 4 additions & 2 deletions tests/components/input_shortcut.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

import { vi, expect, test, beforeEach } from 'vitest'
import { mount, VueWrapper } from '@vue/test-utils'
import { vi, expect, test, beforeEach, afterAll } from 'vitest'
import { mount, VueWrapper, enableAutoUnmount } from '@vue/test-utils'
import InputShortcut from '../../src/components/InputShortcut.vue'

enableAutoUnmount(afterAll)

let wrapper: VueWrapper<any>

window.api = {
Expand Down
6 changes: 4 additions & 2 deletions tests/screens/commands.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

import { vi, beforeEach, expect, test } from 'vitest'
import { mount } from '@vue/test-utils'
import { vi, beforeEach, expect, test, afterAll } from 'vitest'
import { enableAutoUnmount, mount } from '@vue/test-utils'
import Commands from '../../src/screens/Commands.vue'
import defaults from '../../defaults/settings.json'

enableAutoUnmount(afterAll)

window.api = {
config: {
load: vi.fn(() => defaults),
Expand Down
6 changes: 4 additions & 2 deletions tests/screens/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { vi, beforeEach, expect, test } from 'vitest'
import { mount } from '@vue/test-utils'
import { vi, beforeEach, expect, test, afterAll } from 'vitest'
import { enableAutoUnmount, mount } from '@vue/test-utils'
import { store } from '../../src/services/store'
import Main from '../../src/screens/Main.vue'
import Sidebar from '../../src/components/Sidebar.vue'
Expand All @@ -12,6 +12,8 @@ import * as _Assistant from '../../src/services/assistant'
import useEventBus from '../../src/composables/useEventBus'
const { emitEvent } = useEventBus()

enableAutoUnmount(afterAll)

window.api = {
config: {
load: vi.fn(() => defaults),
Expand Down
6 changes: 4 additions & 2 deletions tests/screens/prompt.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

import { vi, beforeEach, expect, test } from 'vitest'
import { mount } from '@vue/test-utils'
import { vi, beforeEach, expect, test, afterAll } from 'vitest'
import { enableAutoUnmount, mount } from '@vue/test-utils'
import Prompt from '../../src/components/Prompt.vue'
import PromptAnywhere from '../../src/screens/PromptAnywhere.vue'
import defaults from '../../defaults/settings.json'

import useEventBus from '../../src/composables/useEventBus'
const { emitEvent } = useEventBus()

enableAutoUnmount(afterAll)

window.api = {
config: {
load: vi.fn(() => defaults),
Expand Down
6 changes: 4 additions & 2 deletions tests/screens/wait.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@

import { vi, expect, test } from 'vitest'
import { mount } from '@vue/test-utils'
import { vi, expect, test, afterAll } from 'vitest'
import { enableAutoUnmount, mount } from '@vue/test-utils'
import Wait from '../../src/screens/Wait.vue'

enableAutoUnmount(afterAll)

window.api = {
commands: {
cancel: vi.fn()
Expand Down

0 comments on commit 3d24077

Please sign in to comment.