File tree Expand file tree Collapse file tree 1 file changed +23
-9
lines changed Expand file tree Collapse file tree 1 file changed +23
-9
lines changed Original file line number Diff line number Diff line change 1- import { createApp , h } from 'vue'
2- import { test , expect } from 'vitest'
1+ import { createApp , h } from 'vue'
2+ import { test , expect } from 'vitest'
33import { useMetadata } from '../../src/index'
44
55test ( 'toFormValues' , ( ) => {
6- const { toFormValues } = useMetadata ( )
7- const a = { a : "foo" , b : 1 , c :null }
8- const b = toFormValues ( a )
6+ let result : any
7+
8+ // Create a Vue app to provide the proper context for the composable
9+ const app = createApp ( {
10+ setup ( ) {
11+ const { toFormValues } = useMetadata ( )
12+ const a = { a : "foo" , b : 1 , c : null }
13+ const b = toFormValues ( a )
14+
15+ result = { a, b }
16+ return { }
17+ } ,
18+ render : ( ) => h ( 'div' )
19+ } )
20+
21+ const container = document . createElement ( 'div' )
22+ app . mount ( container )
923
1024 // toFormValues mutates and returns original argument
11- expect ( a === b ) . true
12- expect ( a . a ) . eq ( 'foo' )
13- expect ( a . b ) . eq ( 1 )
14- expect ( a . c ) . eq ( null )
25+ expect ( result . a === result . b ) . toBe ( true )
26+ expect ( result . a . a ) . toBe ( 'foo' )
27+ expect ( result . a . b ) . toBe ( 1 )
28+ expect ( result . a . c ) . toBe ( null )
1529} )
You can’t perform that action at this time.
0 commit comments