@@ -11,7 +11,7 @@ const region: { cma: string; cda: string; name: string } =
11
11
const developerHubBaseUrl = getDeveloperHubUrl ( ) ;
12
12
13
13
describe ( "app:deploy" , ( ) => {
14
- describe ( "Deploy an with custom hosting" , ( ) => {
14
+ describe ( "Deploy an app with custom hosting" , ( ) => {
15
15
test
16
16
. stdout ( { print : process . env . PRINT === "true" || false } )
17
17
. stub ( ux . action , "stop" , ( ) => { } )
@@ -22,7 +22,7 @@ describe("app:deploy", () => {
22
22
App : mock . apps [ 1 ] . name ,
23
23
Organization : mock . organizations [ 0 ] . name ,
24
24
"hosting types" : "Custom Hosting" ,
25
- "app-url" : "https://example.com" ,
25
+ appUrl : "https://example.com" ,
26
26
} ;
27
27
return ( cases as Record < string , any > ) [ prompt . name ] ;
28
28
} )
@@ -35,40 +35,61 @@ describe("app:deploy", () => {
35
35
api
36
36
. get ( "/manifests?limit=50&asc=name&include_count=true&skip=0" )
37
37
. reply ( 200 , {
38
- data : mock . apps ,
38
+ data : mock . apps2 ,
39
39
} )
40
40
)
41
41
. nock ( `https://${ developerHubBaseUrl } ` , ( api ) =>
42
- api . put ( `/manifests/${ mock . apps [ 1 ] . uid } ` ) . reply ( 200 , {
43
- data : mock . apps ,
44
- } )
42
+ api . put ( `/manifests/${ mock . apps2 [ 1 ] . uid } ` ) . reply ( 200 , mock . deploy_custom_host )
45
43
)
46
- . nock ( `https://${ developerHubBaseUrl } ` , ( api ) =>
44
+ . command ( [ "app:deploy" ] )
45
+ . do ( ( { stdout } ) => {
46
+ expect ( stdout ) . to . contain (
47
+ $t ( messages . APP_DEPLOYED , { app : mock . apps [ 1 ] . name } )
48
+ ) ;
49
+ } )
50
+ . it ( "should deploy the app with custom hosting" ) ;
51
+ } ) ;
52
+
53
+ describe ( "Deploy an app with Hosting with Launch with existing project" , ( ) => {
54
+ test
55
+ . stdout ( { print : process . env . PRINT === "true" || false } )
56
+ . stub ( ux . action , "stop" , ( ) => { } )
57
+ . stub ( ux . action , "start" , ( ) => { } )
58
+ . stub ( cliux , "inquire" , async ( ...args : any ) => {
59
+ const [ prompt ] : any = args ;
60
+ const cases = {
61
+ App : mock . apps2 [ 1 ] . name ,
62
+ Organization : mock . organizations [ 0 ] . name ,
63
+ "hosting types" : "Hosting with Launch" ,
64
+ "provider" : "launch" ,
65
+ "selected_launch_project" :"existing" ,
66
+ "deployment_url" : "https://example.com" ,
67
+ "environment_uid" : "environment_uid" ,
68
+ "project_uid" : "project_uid" ,
69
+ } ;
70
+ return ( cases as Record < string , any > ) [ prompt . name ] ;
71
+ } )
72
+ . nock ( region . cma , ( api ) =>
47
73
api
48
- . patch ( `/manifests/${ mock . apps [ 1 ] . uid } /hosting/disconnect` )
49
- . reply ( 200 , {
50
- data : mock . apps ,
51
- } )
74
+ . get ( "/v3/organizations?limit=100&asc=name&include_count=true&skip=0" )
75
+ . reply ( 200 , { organizations : mock . organizations } )
52
76
)
53
77
. nock ( `https://${ developerHubBaseUrl } ` , ( api ) =>
54
78
api
55
- . put ( `/manifests/${ mock . apps [ 1 ] . uid } /hosting` , {
56
- hosting : {
57
- provider : "external" ,
58
- deployment_url : "https://example.com" ,
59
- } ,
60
- uid : mock . apps [ 1 ] . uid ,
61
- } )
79
+ . get ( "/manifests?limit=50&asc=name&include_count=true&skip=0" )
62
80
. reply ( 200 , {
63
- data : mock . apps ,
81
+ data : mock . apps2 ,
64
82
} )
65
83
)
84
+ . nock ( `https://${ developerHubBaseUrl } ` , ( api ) =>
85
+ api . put ( `/manifests/${ mock . apps2 [ 1 ] . uid } ` ) . reply ( 200 , mock . deploy_launch_host )
86
+ )
66
87
. command ( [ "app:deploy" ] )
67
88
. do ( ( { stdout } ) => {
68
89
expect ( stdout ) . to . contain (
69
- $t ( messages . APP_DEPLOYED , { app : mock . apps [ 1 ] . name } )
90
+ $t ( messages . APP_DEPLOYED , { app : mock . apps2 [ 1 ] . name } )
70
91
) ;
71
92
} )
72
- . it ( "should deploy the app with custom hosting " ) ;
93
+ . it ( "should deploy the app with Hosting with Launch with existing project " ) ;
73
94
} ) ;
74
95
} ) ;
0 commit comments