@@ -16,7 +16,7 @@ import {
16
16
import { expect } from 'chai' ;
17
17
import { basename , join } from 'path' ;
18
18
import { MOCK_ASYNC_RESULT , stubMetadataDeploy } from '../mock/client/transferOperations' ;
19
- import { DeployResult } from '../../src/client/metadataApiDeploy' ;
19
+ import { DeployResult , MetadataApiDeploy } from '../../src/client/metadataApiDeploy' ;
20
20
import { mockRegistry , matchingContentFile } from '../mock/registry' ;
21
21
import { META_XML_SUFFIX } from '../../src/common' ;
22
22
import {
@@ -553,4 +553,37 @@ describe('MetadataApiDeploy', () => {
553
553
} ) ;
554
554
} ) ;
555
555
} ) ;
556
+
557
+ describe ( 'Constructor' , ( ) => {
558
+ it ( 'should merge default API options' , ( ) => {
559
+ const mdApiDeploy = new MetadataApiDeploy ( {
560
+ usernameOrConnection : 'testing' ,
561
+ components : new ComponentSet ( ) ,
562
+ apiOptions : {
563
+ checkOnly : true ,
564
+ testLevel : 'RunLocalTests' ,
565
+ } ,
566
+ } ) ;
567
+ // @ts -ignore testing private property
568
+ const mdOpts = mdApiDeploy . options ;
569
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'checkOnly' , true ) ;
570
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'rollbackOnError' , true ) ;
571
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'ignoreWarnings' , false ) ;
572
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'singlePackage' , true ) ;
573
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'testLevel' , 'RunLocalTests' ) ;
574
+ } ) ;
575
+
576
+ it ( 'should use default API options' , ( ) => {
577
+ const mdApiDeploy = new MetadataApiDeploy ( {
578
+ usernameOrConnection : 'testing' ,
579
+ components : new ComponentSet ( ) ,
580
+ } ) ;
581
+ // @ts -ignore testing private property
582
+ const mdOpts = mdApiDeploy . options ;
583
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'rollbackOnError' , true ) ;
584
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'ignoreWarnings' , false ) ;
585
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'checkOnly' , false ) ;
586
+ expect ( mdOpts . apiOptions ) . to . have . property ( 'singlePackage' , true ) ;
587
+ } ) ;
588
+ } ) ;
556
589
} ) ;
0 commit comments