File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,10 @@ export class ListMetadata extends SourceCommand {
6868
6969 this . validateResultFile ( ) ;
7070
71- const query : ListMetadataQuery = { type, folder } ;
71+ const query : ListMetadataQuery = { type } ;
72+ if ( folder ) {
73+ query . folder = folder ;
74+ }
7275 const connection = this . org . getConnection ( ) ;
7376 const result = ( await connection . metadata . list ( query , apiversion ) ) || [ ] ;
7477 this . listResult = Array . isArray ( result ) ? result : [ result ] ;
Original file line number Diff line number Diff line change @@ -49,12 +49,22 @@ describe('mdapi NUTs', () => {
4949 } ) ;
5050
5151 describe ( 'mdapi:listmetadata' , ( ) => {
52- it ( 'should successfully execute listmetadata' , ( ) => {
52+ it ( 'should successfully execute listmetadata for type CustomObject ' , ( ) => {
5353 const result = execCmd ( 'force:mdapi:listmetadata --json --metadatatype CustomObject' ) ;
5454 expect ( result . jsonOutput . status ) . to . equal ( 0 ) ;
5555 expect ( result . jsonOutput . result ) . to . be . an ( 'array' ) . with . length . greaterThan ( 100 ) ;
5656 expect ( result . jsonOutput . result [ 0 ] ) . to . have . property ( 'type' , 'CustomObject' ) ;
5757 } ) ;
58+
59+ it ( 'should successfully execute listmetadata for type ListView' , ( ) => {
60+ // ListView is sensitive to how the connection.metadata.list() call is made.
61+ // e.g., if you pass { type: 'ListView', folder: undefined } it will not return
62+ // any ListViews but if you pass { type: 'ListView' } it returns all ListViews.
63+ const result = execCmd ( 'force:mdapi:listmetadata --json --metadatatype ListView' ) ;
64+ expect ( result . jsonOutput . status ) . to . equal ( 0 ) ;
65+ expect ( result . jsonOutput . result ) . to . be . an ( 'array' ) . with . length . greaterThan ( 10 ) ;
66+ expect ( result . jsonOutput . result [ 0 ] ) . to . have . property ( 'type' , 'ListView' ) ;
67+ } ) ;
5868 } ) ;
5969
6070 describe ( 'mdapi:describemetadata' , ( ) => {
You can’t perform that action at this time.
0 commit comments