@@ -322,6 +322,91 @@ describe('MetadataApiDeploy', () => {
322
322
expect ( responses ) . to . deep . equal ( expected ) ;
323
323
} ) ;
324
324
325
+ describe ( 'namespaced lwc failures' , ( ) => {
326
+ const bundlePath = join ( 'path' , 'to' , 'lwc' , 'test' ) ;
327
+ const props = {
328
+ name : 'test' ,
329
+ type : registry . types . lightningcomponentbundle ,
330
+ xml : join ( bundlePath , 'test.js-meta.xml' ) ,
331
+ content : bundlePath ,
332
+ } ;
333
+ const component = SourceComponent . createVirtualComponent ( props , [
334
+ {
335
+ dirPath : bundlePath ,
336
+ children : [ basename ( props . xml ) , 'test.js' , 'test.html' ] ,
337
+ } ,
338
+ ] ) ;
339
+ const deployedSet = new ComponentSet ( [ component ] ) ;
340
+ const { fullName, type } = component ;
341
+ const problem = 'something went wrong' ;
342
+ const problemType = 'Error' ;
343
+ const componentSuccesses = {
344
+ changed : 'true' ,
345
+ created : 'false' ,
346
+ deleted : 'false' ,
347
+ success : 'true' ,
348
+ fullName,
349
+ componentType : type . name ,
350
+ } as DeployMessage ;
351
+
352
+ const componentFailures = {
353
+ changed : 'false' ,
354
+ created : 'false' ,
355
+ deleted : 'false' ,
356
+ success : 'false' ,
357
+ problem,
358
+ problemType,
359
+ fileName : join ( bundlePath , `${ fullName } .html` ) ,
360
+ componentType : type . name ,
361
+ } as DeployMessage ;
362
+
363
+ it ( 'should handle default namespace failure for "LightningComponentBundle" type' , ( ) => {
364
+ const apiStatus : Partial < MetadataApiDeployStatus > = {
365
+ details : {
366
+ componentSuccesses,
367
+ componentFailures : { ...componentFailures , fullName : `markup://c:${ fullName } ` } ,
368
+ } ,
369
+ } ;
370
+ const result = new DeployResult ( apiStatus as MetadataApiDeployStatus , deployedSet ) ;
371
+
372
+ const responses = result . getFileResponses ( ) ;
373
+ const expected = [
374
+ {
375
+ fullName,
376
+ type : type . name ,
377
+ error : problem ,
378
+ problemType,
379
+ state : ComponentStatus . Failed ,
380
+ filePath : componentFailures . fileName ,
381
+ } ,
382
+ ] as FileResponse [ ] ;
383
+ expect ( responses ) . to . deep . equal ( expected ) ;
384
+ } ) ;
385
+
386
+ it ( 'should handle custom namespace failure for "LightningComponentBundle" type' , ( ) => {
387
+ const apiStatus : Partial < MetadataApiDeployStatus > = {
388
+ details : {
389
+ componentSuccesses,
390
+ componentFailures : { ...componentFailures , fullName : `markup://my_NS:${ fullName } ` } ,
391
+ } ,
392
+ } ;
393
+ const result = new DeployResult ( apiStatus as MetadataApiDeployStatus , deployedSet ) ;
394
+
395
+ const responses = result . getFileResponses ( ) ;
396
+ const expected = [
397
+ {
398
+ fullName,
399
+ type : type . name ,
400
+ error : problem ,
401
+ problemType,
402
+ state : ComponentStatus . Failed ,
403
+ filePath : componentFailures . fileName ,
404
+ } ,
405
+ ] as FileResponse [ ] ;
406
+ expect ( responses ) . to . deep . equal ( expected ) ;
407
+ } ) ;
408
+ } ) ;
409
+
325
410
it ( 'should report component as failed if component has success and failure messages' , ( ) => {
326
411
const component = matchingContentFile . COMPONENT ;
327
412
const deployedSet = new ComponentSet ( [ component ] ) ;
0 commit comments