@@ -225,6 +225,33 @@ describe('#update', () => {
225225 assert . equal ( gotTo , `//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd` ) ;
226226 } ) ;
227227
228+
229+ it ( 'add new scoped with dot' , async function ( ) {
230+ fromConfigPath = getConfigPath ( `${ this . test . title } -from` ) ;
231+ toConfigPath = getConfigPath ( `${ this . test . title } -to` )
232+ fs . writeFileSync ( fromConfigPath , `@my.scope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/` ) ;
233+ fs . writeFileSync ( toConfigPath , `` ) ;
234+ await update . updateConfigFiles ( fromConfigPath , toConfigPath , creds ) ;
235+
236+ const gotFrom = fs . readFileSync ( fromConfigPath , 'utf8' ) ;
237+ const gotTo = fs . readFileSync ( toConfigPath , 'utf8' ) ;
238+ assert . equal ( gotFrom , `@my.scope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/` ) ;
239+ assert . equal ( gotTo , `//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd` ) ;
240+ } ) ;
241+
242+ it ( 'add new scoped starting with tilda' , async function ( ) {
243+ fromConfigPath = getConfigPath ( `${ this . test . title } -from` ) ;
244+ toConfigPath = getConfigPath ( `${ this . test . title } -to` )
245+ fs . writeFileSync ( fromConfigPath , `@~myscope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/` ) ;
246+ fs . writeFileSync ( toConfigPath , `` ) ;
247+ await update . updateConfigFiles ( fromConfigPath , toConfigPath , creds ) ;
248+
249+ const gotFrom = fs . readFileSync ( fromConfigPath , 'utf8' ) ;
250+ const gotTo = fs . readFileSync ( toConfigPath , 'utf8' ) ;
251+ assert . equal ( gotFrom , `@~myscope:registry=https://us-west1-npm.pkg.dev/my-project/my-repo/` ) ;
252+ assert . equal ( gotTo , `//us-west1-npm.pkg.dev/my-project/my-repo/:_authToken=abcd` ) ;
253+ } ) ;
254+
228255 it ( 'add new to config file does not exist' , async function ( ) {
229256 fromConfigPath = getConfigPath ( `${ this . test . title } -from` ) ;
230257 toConfigPath = getConfigPath ( `${ this . test . title } -to` )
0 commit comments