@@ -107,7 +107,7 @@ describe('useViewModelInstance - RiveFile with instanceName parameter', () => {
107107 expect ( result . current . error ) . toBeNull ( ) ;
108108 } ) ;
109109
110- it ( 'should return null when instance name not found and required is false' , ( ) => {
110+ it ( 'should return error when instance name not found and required is false' , ( ) => {
111111 const defaultViewModel = createMockViewModel ( {
112112 namedInstances : { } ,
113113 } ) ;
@@ -119,7 +119,8 @@ describe('useViewModelInstance - RiveFile with instanceName parameter', () => {
119119 ) ;
120120
121121 expect ( result . current . instance ) . toBeNull ( ) ;
122- expect ( result . current . error ) . toContain ( 'not found' ) ;
122+ expect ( result . current . error ) . toBeInstanceOf ( Error ) ;
123+ expect ( result . current . error ?. message ) . toContain ( 'NonExistent' ) ;
123124 } ) ;
124125
125126 it ( 'should throw when instance name not found and required is true' , ( ) => {
@@ -139,7 +140,7 @@ describe('useViewModelInstance - RiveFile with instanceName parameter', () => {
139140 ) . toThrow ( "ViewModel instance 'NonExistent' not found" ) ;
140141 } ) ;
141142
142- it ( 'should return null when artboardName not found and required is false' , ( ) => {
143+ it ( 'should return error when artboardName not found and required is false' , ( ) => {
143144 const mockRiveFile = createMockRiveFile ( {
144145 artboardViewModels : { } ,
145146 } ) ;
@@ -149,7 +150,8 @@ describe('useViewModelInstance - RiveFile with instanceName parameter', () => {
149150 ) ;
150151
151152 expect ( result . current . instance ) . toBeNull ( ) ;
152- expect ( result . current . error ) . toContain ( 'not found' ) ;
153+ expect ( result . current . error ) . toBeInstanceOf ( Error ) ;
154+ expect ( result . current . error ?. message ) . toContain ( 'MissingArtboard' ) ;
153155 } ) ;
154156
155157 it ( 'should throw when artboardName not found and required is true' , ( ) => {
@@ -262,7 +264,7 @@ describe('useViewModelInstance - RiveFile with viewModelName parameter', () => {
262264 expect ( result . current . error ) . toBeNull ( ) ;
263265 } ) ;
264266
265- it ( 'should return null when viewModelName not found and required is false' , ( ) => {
267+ it ( 'should return error when viewModelName not found and required is false' , ( ) => {
266268 const mockRiveFile = createMockRiveFile ( {
267269 namedViewModels : { } ,
268270 } ) ;
@@ -272,7 +274,8 @@ describe('useViewModelInstance - RiveFile with viewModelName parameter', () => {
272274 ) ;
273275
274276 expect ( result . current . instance ) . toBeNull ( ) ;
275- expect ( result . current . error ) . toContain ( 'not found' ) ;
277+ expect ( result . current . error ) . toBeInstanceOf ( Error ) ;
278+ expect ( result . current . error ?. message ) . toContain ( 'NonExistent' ) ;
276279 } ) ;
277280
278281 it ( 'should throw when viewModelName not found and required is true' , ( ) => {
0 commit comments