@@ -24,7 +24,7 @@ function createTestInjector() {
24
24
testInjector . register ( "prompter" , { } ) ;
25
25
testInjector . register ( "platformEnvironmentRequirements" , PlatformEnvironmentRequirements ) ;
26
26
testInjector . register ( "staticConfig" , { SYS_REQUIREMENTS_LINK : "" } ) ;
27
- testInjector . register ( "nativescriptCloudExtensionService " , { } ) ;
27
+ testInjector . register ( "nativeScriptCloudExtensionService " , { } ) ;
28
28
29
29
return testInjector ;
30
30
}
@@ -59,10 +59,10 @@ describe("platformEnvironmentRequirements ", () => {
59
59
} ;
60
60
}
61
61
62
- function mockNativescriptCloudExtensionService ( data : { isInstalled : boolean } ) {
63
- const nativescriptCloudExtensionService = testInjector . resolve ( "nativescriptCloudExtensionService " ) ;
64
- nativescriptCloudExtensionService . isInstalled = ( ) => data . isInstalled ;
65
- nativescriptCloudExtensionService . install = ( ) => { isExtensionInstallCalled = true ; } ;
62
+ function mockNativeScriptCloudExtensionService ( data : { isInstalled : boolean } ) {
63
+ const nativeScriptCloudExtensionService = testInjector . resolve ( "nativeScriptCloudExtensionService " ) ;
64
+ nativeScriptCloudExtensionService . isInstalled = ( ) => data . isInstalled ;
65
+ nativeScriptCloudExtensionService . install = ( ) => { isExtensionInstallCalled = true ; } ;
66
66
}
67
67
68
68
beforeEach ( ( ) => {
@@ -87,7 +87,7 @@ describe("platformEnvironmentRequirements ", () => {
87
87
it ( "should show prompt when environment is not configured and nativescript-cloud extension is not installed" , async ( ) => {
88
88
mockDoctorService ( { canExecuteLocalBuild : false } ) ;
89
89
mockPrompter ( { firstCallOptionName : PlatformEnvironmentRequirements . CLOUD_SETUP_OPTION_NAME } ) ;
90
- mockNativescriptCloudExtensionService ( { isInstalled : false } ) ;
90
+ mockNativeScriptCloudExtensionService ( { isInstalled : false } ) ;
91
91
92
92
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) ) ;
93
93
assert . isTrue ( promptForChoiceData . length === 1 ) ;
@@ -98,7 +98,7 @@ describe("platformEnvironmentRequirements ", () => {
98
98
it ( "should show prompt when environment is not configured and nativescript-cloud extension is installed" , async ( ) => {
99
99
mockDoctorService ( { canExecuteLocalBuild : false } ) ;
100
100
mockPrompter ( { firstCallOptionName : PlatformEnvironmentRequirements . CLOUD_SETUP_OPTION_NAME } ) ;
101
- mockNativescriptCloudExtensionService ( { isInstalled : true } ) ;
101
+ mockNativeScriptCloudExtensionService ( { isInstalled : true } ) ;
102
102
103
103
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) ) ;
104
104
assert . isTrue ( promptForChoiceData . length === 1 ) ;
@@ -123,7 +123,7 @@ describe("platformEnvironmentRequirements ", () => {
123
123
doctorService . canExecuteLocalBuild = ( ) => false ;
124
124
doctorService . runSetupScript = async ( ) => { doctorService . canExecuteLocalBuild = ( ) => true ; } ;
125
125
126
- mockNativescriptCloudExtensionService ( { isInstalled : null } ) ;
126
+ mockNativeScriptCloudExtensionService ( { isInstalled : null } ) ;
127
127
128
128
assert . isTrue ( await platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) ) ;
129
129
} ) ;
@@ -132,14 +132,14 @@ describe("platformEnvironmentRequirements ", () => {
132
132
it ( "should setup manually when cloud extension is installed" , async ( ) => {
133
133
mockDoctorService ( { canExecuteLocalBuild : false , mockSetupScript : true } ) ;
134
134
mockPrompter ( { firstCallOptionName : PlatformEnvironmentRequirements . LOCAL_SETUP_OPTION_NAME , secondCallOptionName : PlatformEnvironmentRequirements . MANUALLY_SETUP_OPTION_NAME } ) ;
135
- mockNativescriptCloudExtensionService ( { isInstalled : true } ) ;
135
+ mockNativeScriptCloudExtensionService ( { isInstalled : true } ) ;
136
136
137
137
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) , manuallySetupErrorMessage ) ;
138
138
} ) ;
139
139
describe ( "and cloud extension is not installed" , ( ) => {
140
140
beforeEach ( ( ) => {
141
141
mockDoctorService ( { canExecuteLocalBuild : false , mockSetupScript : true } ) ;
142
- mockNativescriptCloudExtensionService ( { isInstalled : false } ) ;
142
+ mockNativeScriptCloudExtensionService ( { isInstalled : false } ) ;
143
143
} ) ;
144
144
it ( "should list 2 posibile options to select" , async ( ) => {
145
145
mockPrompter ( { firstCallOptionName : PlatformEnvironmentRequirements . LOCAL_SETUP_OPTION_NAME } ) ;
@@ -168,7 +168,7 @@ describe("platformEnvironmentRequirements ", () => {
168
168
} ) ;
169
169
170
170
it ( "should install nativescript-cloud extension when it is not installed" , async ( ) => {
171
- mockNativescriptCloudExtensionService ( { isInstalled : false } ) ;
171
+ mockNativeScriptCloudExtensionService ( { isInstalled : false } ) ;
172
172
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) , cloudBuildsErrorMessage ) ;
173
173
assert . isTrue ( isExtensionInstallCalled ) ;
174
174
} ) ;
@@ -181,11 +181,11 @@ describe("platformEnvironmentRequirements ", () => {
181
181
} ) ;
182
182
183
183
it ( "should fail when nativescript-cloud extension is installed" , async ( ) => {
184
- mockNativescriptCloudExtensionService ( { isInstalled : true } ) ;
184
+ mockNativeScriptCloudExtensionService ( { isInstalled : true } ) ;
185
185
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) , manuallySetupErrorMessage ) ;
186
186
} ) ;
187
187
it ( "should fail when nativescript-cloud extension is not installed" , async ( ) => {
188
- mockNativescriptCloudExtensionService ( { isInstalled : false } ) ;
188
+ mockNativeScriptCloudExtensionService ( { isInstalled : false } ) ;
189
189
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) , manuallySetupErrorMessage ) ;
190
190
} ) ;
191
191
} ) ;
@@ -198,11 +198,11 @@ describe("platformEnvironmentRequirements ", () => {
198
198
} ) ;
199
199
200
200
it ( "should fail when nativescript-cloud extension is installed" , async ( ) => {
201
- mockNativescriptCloudExtensionService ( { isInstalled : true } ) ;
201
+ mockNativeScriptCloudExtensionService ( { isInstalled : true } ) ;
202
202
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) , nonInteractiveConsoleMessageWhenExtensionIsInstalled ) ;
203
203
} ) ;
204
204
it ( "should fail when nativescript-cloud extension is not installed" , async ( ) => {
205
- mockNativescriptCloudExtensionService ( { isInstalled : false } ) ;
205
+ mockNativeScriptCloudExtensionService ( { isInstalled : false } ) ;
206
206
await assert . isRejected ( platformEnvironmentRequirements . checkEnvironmentRequirements ( platform ) , nonInteractiveConsoleMessageWhenExtensionIsNotInstalled ) ;
207
207
} ) ;
208
208
} ) ;
0 commit comments