@@ -157,7 +157,26 @@ describe("generator-biojs-webcomponents:app - Upgrade an existing component by i
157
157
} ) ;
158
158
} ) ;
159
159
160
+ describe ( "generator-biojs-webcomponents:app - Upgrade an existing component by installing component from npm package" , ( ) => {
161
+ it ( "installs the latest component from its npm package if user enters a valid version" , async ( ) => {
162
+ let res = await validators . checkVersionAndInstallComponent ( "latest" , {
163
+ packageNameToInstallComponent : "http-server"
164
+ } ) ;
165
+ assert . equal ( res , true ) ;
166
+ } ) ;
167
+ } ) ;
168
+
160
169
describe ( "generator-biojs-webcomponents:app - Upgrade an existing component by importing build file using npm" , ( ) => {
170
+ it ( "runs the generator in the directory passed in arguments" , async ( ) => {
171
+ await validators . storeArg ( "test-component" ) . then ( ( ) => {
172
+ assert . file ( "test-component" ) ;
173
+ } ) ;
174
+ } ) ;
175
+ it ( "makes a new directory named - component-dist" , async ( ) => {
176
+ await validators
177
+ . directoryName ( "component-dist" )
178
+ . then ( ( ) => assert . file ( [ "test-component/component-dist" ] ) ) ;
179
+ } ) ;
161
180
it ( "throws an error if version entered does not exist" , async ( ) => {
162
181
assert . equal (
163
182
await validators . version ( "fkdk" , { packageName : "node" } ) ,
@@ -170,6 +189,15 @@ describe("generator-biojs-webcomponents:app - Upgrade an existing component by i
170
189
)
171
190
) ;
172
191
} ) ;
192
+ it ( "downloads the URL of build file entered is correct" , async ( ) => {
193
+ await validators
194
+ . importBuildFileFromNPM (
195
+ "https://cdn.jsdelivr.net/npm/[email protected] /index.min.js"
196
+ )
197
+ . then ( ( ) => {
198
+ assert . file ( "test-component/component-dist/index.min.js" ) ;
199
+ } ) ;
200
+ } ) ;
173
201
it ( "throws an error if an npm package doesn't exist" , async ( ) => {
174
202
assert . equal (
175
203
await validators . packageName ( "cbaxyz" ) ,
0 commit comments