11import { mount } from '@vue/test-utils'
22import { it , describe , expect } from 'vitest'
33import { uploadString } from 'firebase/storage'
4- import { nextTick , ref } from 'vue'
4+ import { defineComponent , nextTick , ref } from 'vue'
55import {
66 useFirebaseStorage ,
77 useStorageFileMetadata ,
@@ -16,14 +16,16 @@ describe('Storage', () => {
1616 it ( 'generates a URL' , async ( ) => {
1717 const objectRef = storageRef ( 'my-url.jpg' )
1818 await uploadString ( objectRef , 'test' , 'raw' )
19- const wrapper = mount ( {
20- template : 'no' ,
21- setup ( ) {
22- const { url, promise } = useStorageFileUrl ( objectRef )
19+ const wrapper = mount (
20+ defineComponent ( {
21+ template : 'no' ,
22+ setup ( ) {
23+ const { url, promise } = useStorageFileUrl ( objectRef )
2324
24- return { url, promise }
25- } ,
26- } )
25+ return { url, promise }
26+ } ,
27+ } )
28+ )
2729
2830 await wrapper . vm . promise
2931
@@ -34,14 +36,16 @@ describe('Storage', () => {
3436 it ( 'generates the metadata' , async ( ) => {
3537 const objectRef = storageRef ( 'my-url.jpg' )
3638 await uploadString ( objectRef , 'test' , 'raw' )
37- const wrapper = mount ( {
38- template : 'no' ,
39- setup ( ) {
40- const { metadata, promise } = useStorageFileMetadata ( objectRef )
39+ const wrapper = mount (
40+ defineComponent ( {
41+ template : 'no' ,
42+ setup ( ) {
43+ const { metadata, promise } = useStorageFileMetadata ( objectRef )
4144
42- return { metadata, promise }
43- } ,
44- } )
45+ return { metadata, promise }
46+ } ,
47+ } )
48+ )
4549
4650 await wrapper . vm . promise
4751
@@ -54,14 +58,17 @@ describe('Storage', () => {
5458 it ( 'can create upload tasks' , async ( ) => {
5559 const objectRef = storageRef ( 'my-url.jpg' )
5660 await uploadString ( objectRef , 'test' , 'raw' )
57- const wrapper = mount ( {
58- template : 'no' ,
59- setup ( ) {
60- const { uploadTask, upload, uploadProgress } = useStorageFile ( objectRef )
61+ const wrapper = mount (
62+ defineComponent ( {
63+ template : 'no' ,
64+ setup ( ) {
65+ const { uploadTask, upload, uploadProgress } =
66+ useStorageFile ( objectRef )
6167
62- return { uploadTask, upload, uploadProgress }
63- } ,
64- } )
68+ return { uploadTask, upload, uploadProgress }
69+ } ,
70+ } )
71+ )
6572
6673 await nextTick ( )
6774
0 commit comments