11import type { Ref } from "vue"
2- import { ref } from "vue"
32import { mount } from "@vue/test-utils"
4- import { describe , it , expect } from "vitest"
3+ import { describe , it , expect , vi } from "vitest"
54
65import RefFamily from "./App.vue"
76
@@ -18,18 +17,17 @@ describe("RefFamily", () => {
1817 it ( "update ref function" , ( ) => {
1918 const wrapper = mount ( RefFamily ) ;
2019 ( wrapper . vm as unknown as RefFamilyType ) . update ( 996 )
21- expect ( ( wrapper . vm as unknown as RefFamilyType ) . count ) . toMatchInlineSnapshot ( " 996" )
20+ expect ( ( wrapper . vm as unknown as RefFamilyType ) . count ) . toBe ( 996 )
2221 } )
2322
24- it ( "Unwrap ref" , ( ) => {
25- const wrapper = mount ( RefFamily )
26- expect ( ( wrapper . vm as unknown as RefFamilyType ) . initialCount ( 996 ) ) . toMatchInlineSnapshot ( "996" )
27- expect ( ( wrapper . vm as unknown as RefFamilyType ) . initialCount ( ref ( 996 ) ) ) . toMatchInlineSnapshot ( "996" )
28- } )
29-
30- it ( "create a ref for a property on a source reactive object" , ( ) => {
31- const wrapper = mount ( RefFamily )
32- expect ( ( wrapper . vm as unknown as RefFamilyType ) . fooRef ) . toMatchInlineSnapshot ( '3' )
33- expect ( ( wrapper . vm as unknown as RefFamilyType ) . state . foo ) . toMatchInlineSnapshot ( '3' )
23+ it ( "should work" , ( ) => {
24+ const result : string [ ] = [ ]
25+ console . log = vi . fn ( ( log : string ) => {
26+ result . push ( log )
27+ } )
28+ mount ( RefFamily )
29+ expect ( JSON . stringify ( result ) ) . toBe ( JSON . stringify ( [
30+ 1 , true , true , true ,
31+ ] ) )
3432 } )
3533} )
0 commit comments