@@ -120,6 +120,15 @@ describe('services > model', () => {
120
120
expect ( modelMocks . save ) . not . toBeCalled ( )
121
121
} )
122
122
123
+ test ( 'createModel > should throw an internal error if getUserInformation fails due to invalid user' , async ( ) => {
124
+ authenticationMocks . getUserInformation . mockImplementation ( ( ) => {
125
+ throw new Error ( 'Unable to find user user:unknown_user' )
126
+ } )
127
+ expect ( ( ) =>
128
+ createModel ( { } as any , { collaborators : [ { entity : 'user:unknown_user' , roles : [ ] } ] } as any ) ,
129
+ ) . rejects . toThrowError ( / ^ U n a b l e t o f i n d u s e r u s e r : u n k n o w n _ u s e r / )
130
+ } )
131
+
123
132
test ( 'getModelById > good' , async ( ) => {
124
133
modelMocks . findOne . mockResolvedValueOnce ( 'mocked' )
125
134
@@ -327,6 +336,15 @@ describe('services > model', () => {
327
336
) . rejects . toThrowError ( / ^ Y o u c a n n o t s e l e c t b o t h m i r r o r s e t t i n g s s i m u l t a n e o u s l y ./ )
328
337
} )
329
338
339
+ test ( 'updateModel > should throw an internal error if getUserInformation fails due to invalid user' , async ( ) => {
340
+ authenticationMocks . getUserInformation . mockImplementation ( ( ) => {
341
+ throw new Error ( 'Unable to find user user:unknown_user' )
342
+ } )
343
+ expect ( ( ) =>
344
+ updateModel ( { } as any , '123' , { collaborators : [ { entity : 'user:unknown_user' , roles : [ ] } ] } ) ,
345
+ ) . rejects . toThrowError ( / ^ U n a b l e t o f i n d u s e r u s e r : u n k n o w n _ u s e r / )
346
+ } )
347
+
330
348
test ( 'createModelcardFromSchema > should throw an error when attempting to change a model from mirrored to standard' , async ( ) => {
331
349
vi . mocked ( authorisation . model ) . mockResolvedValue ( {
332
350
info : 'Cannot alter a mirrored model.' ,
0 commit comments