33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55
6- import { describe , expect , it , beforeEach , vi } from 'vitest'
6+ import { beforeAll , beforeEach , describe , expect , it , vi } from 'vitest'
77import { shallowMount } from '@vue/test-utils'
88import type { VueWrapper } from '@vue/test-utils'
99import { createPinia , setActivePinia } from 'pinia'
1010import axios from '@nextcloud/axios'
1111import type { useFilesStore as useFilesStoreType } from '../../../store/files.js'
1212let RequestSignatureTab : unknown
13+ let useFilesStore : typeof import ( '../../../store/files.js' ) . useFilesStore
1314import { FILE_STATUS } from '../../../constants.js'
1415
1516const { generateUrlMock } = vi . hoisted ( ( ) => ( {
@@ -78,6 +79,12 @@ vi.mock('@libresign/pdf-elements', () => ({
7879describe ( 'RequestSignatureTab - Critical Business Rules' , ( ) => {
7980 let wrapper : VueWrapper < any >
8081 let filesStore : ReturnType < typeof useFilesStoreType >
82+
83+ beforeAll ( async ( ) => {
84+ RequestSignatureTab = ( await import ( '../../../components/RightSidebar/RequestSignatureTab.vue' ) ) . default
85+ ; ( { useFilesStore } = await import ( '../../../store/files.js' ) )
86+ } )
87+
8188 const updateFile = async ( patch : Record < string , unknown > ) => {
8289 const current = filesStore . files [ 1 ] || { id : 1 }
8390 const hasSigners = Object . prototype . hasOwnProperty . call ( patch , 'signers' )
@@ -103,8 +110,6 @@ describe('RequestSignatureTab - Critical Business Rules', () => {
103110 setActivePinia ( createPinia ( ) )
104111 generateUrlMock . mockClear ( )
105112 vi . mocked ( axios . get ) . mockResolvedValue ( { data : { ocs : { data : null } } } as Awaited < ReturnType < typeof axios . get > > )
106- RequestSignatureTab = ( await import ( '../../../components/RightSidebar/RequestSignatureTab.vue' ) ) . default
107- const { useFilesStore } = await import ( '../../../store/files.js' )
108113 filesStore = useFilesStore ( )
109114
110115 await filesStore . addFile ( {
0 commit comments