@@ -747,15 +747,15 @@ t.test('user-agent', t => {
747
747
definitions [ 'user-agent' ] . flatten ( 'user-agent' , obj , flat )
748
748
t . equal ( flat . userAgent , expectNoCI )
749
749
t . equal ( process . env . npm_config_user_agent , flat . userAgent , 'npm_user_config environment is set' )
750
- t . equal ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is translated' )
750
+ t . not ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is not translated' )
751
751
752
752
obj [ 'ci-name' ] = 'foo'
753
753
obj [ 'user-agent' ] = definitions [ 'user-agent' ] . default
754
754
const expectCI = `${ expectNoCI } ci/foo`
755
755
definitions [ 'user-agent' ] . flatten ( 'user-agent' , obj , flat )
756
756
t . equal ( flat . userAgent , expectCI )
757
757
t . equal ( process . env . npm_config_user_agent , flat . userAgent , 'npm_user_config environment is set' )
758
- t . equal ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is translated' )
758
+ t . not ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is not translated' )
759
759
760
760
delete obj [ 'ci-name' ]
761
761
obj . workspaces = true
@@ -764,15 +764,15 @@ t.test('user-agent', t => {
764
764
definitions [ 'user-agent' ] . flatten ( 'user-agent' , obj , flat )
765
765
t . equal ( flat . userAgent , expectWorkspaces )
766
766
t . equal ( process . env . npm_config_user_agent , flat . userAgent , 'npm_user_config environment is set' )
767
- t . equal ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is translated' )
767
+ t . not ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is not translated' )
768
768
769
769
delete obj . workspaces
770
770
obj . workspace = [ 'foo' ]
771
771
obj [ 'user-agent' ] = definitions [ 'user-agent' ] . default
772
772
definitions [ 'user-agent' ] . flatten ( 'user-agent' , obj , flat )
773
773
t . equal ( flat . userAgent , expectWorkspaces )
774
774
t . equal ( process . env . npm_config_user_agent , flat . userAgent , 'npm_user_config environment is set' )
775
- t . equal ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is translated' )
775
+ t . not ( obj [ 'user-agent' ] , flat . userAgent , 'config user-agent template is not translated' )
776
776
t . end ( )
777
777
} )
778
778
@@ -853,3 +853,29 @@ t.test('package-lock-only', t => {
853
853
t . strictSame ( flat , { packageLock : false , packageLockOnly : false } )
854
854
t . end ( )
855
855
} )
856
+
857
+ t . test ( 'workspaces' , t => {
858
+ const obj = {
859
+ workspaces : true ,
860
+ 'user-agent' : definitions [ 'user-agent' ] . default ,
861
+ 'npm-version' : '1.2.3' ,
862
+ 'node-version' : '9.8.7' ,
863
+ }
864
+ const flat = { }
865
+ definitions . workspaces . flatten ( 'workspaces' , obj , flat )
866
+ t . equal ( flat . userAgent , 'npm/1.2.3 node/9.8.7 darwin x64 workspaces/true' )
867
+ t . end ( )
868
+ } )
869
+
870
+ t . test ( 'workspace' , t => {
871
+ const obj = {
872
+ workspace : [ 'workspace-a' ] ,
873
+ 'user-agent' : definitions [ 'user-agent' ] . default ,
874
+ 'npm-version' : '1.2.3' ,
875
+ 'node-version' : '9.8.7' ,
876
+ }
877
+ const flat = { }
878
+ definitions . workspace . flatten ( 'workspaces' , obj , flat )
879
+ t . equal ( flat . userAgent , 'npm/1.2.3 node/9.8.7 darwin x64 workspaces/true' )
880
+ t . end ( )
881
+ } )
0 commit comments