@@ -13,7 +13,10 @@ module LicenseFinder
1313 {
1414 'type' => 'table' ,
1515 'data' => {
16- 'body' => [ [ 'yn' , '2.0.0' , 'MIT' , 'https://github.com/sindresorhus/yn.git' , 'sindresorhus.com' , 'Sindre Sorhus' ] ] ,
16+ 'body' => [
17+ [ '@sindresorhus/is' , '0.7.0' , 'MIT' , 'https://github.com/sindresorhus/is.git' , 'sindresorhus.com' , 'Sindre Sorhus' ] ,
18+ [ 'yn' , '2.0.0' , 'MIT' , 'https://github.com/sindresorhus/yn.git' , 'sindresorhus.com' , 'Sindre Sorhus' ]
19+ ] ,
1720 'head' => %w[ Name Version License URL VendorUrl VendorName ]
1821 }
1922 } . to_json
@@ -161,6 +164,21 @@ module LicenseFinder
161164 expect ( subject . current_packages . last . authors ) . to eq ''
162165 expect ( subject . current_packages . last . install_path ) . to eq Pathname ( root ) . join ( 'yarn_modules' , '@types/jest' )
163166 end
167+
168+ it 'displays incompatible packages with correct license type' do
169+ allow ( SharedHelpers ::Cmd ) . to receive ( :run ) . with ( Yarn ::SHELL_COMMAND ) do
170+ [
171+ '{"value":"Internal","children":{"@company/package@workspace:.":{"value":{"locator":"@company/package@workspace:.","descriptor":"@company/package@workspace:."},"children":{}}}}' ,
172+ '' ,
173+ cmd_success
174+ ]
175+ end
176+
177+ expect ( subject . current_packages . length ) . to eq 1
178+ expect ( subject . current_packages . last . name ) . to eq '@company/package'
179+ expect ( subject . current_packages . last . version ) . to eq '.'
180+ expect ( subject . current_packages . last . license_names_from_spec ) . to eq [ 'Internal' ]
181+ end
164182 end
165183
166184 it 'displays packages as returned from "yarn list"' do
@@ -171,13 +189,19 @@ module LicenseFinder
171189 [ yarn1_shell_command_output , '' , cmd_success ]
172190 end
173191
174- expect ( subject . current_packages . length ) . to eq 1
175- expect ( subject . current_packages . first . name ) . to eq 'yn '
176- expect ( subject . current_packages . first . version ) . to eq '2.0 .0'
192+ expect ( subject . current_packages . length ) . to eq 2
193+ expect ( subject . current_packages . first . name ) . to eq '@sindresorhus/is '
194+ expect ( subject . current_packages . first . version ) . to eq '0.7 .0'
177195 expect ( subject . current_packages . first . license_names_from_spec ) . to eq [ 'MIT' ]
178196 expect ( subject . current_packages . first . homepage ) . to eq 'sindresorhus.com'
179197 expect ( subject . current_packages . first . authors ) . to eq 'Sindre Sorhus'
180- expect ( subject . current_packages . first . install_path ) . to eq Pathname ( root ) . join ( 'yarn_modules' , 'yn' )
198+ expect ( subject . current_packages . first . install_path ) . to eq Pathname ( root ) . join ( 'yarn_modules' , '@sindresorhus/is' )
199+ expect ( subject . current_packages . last . name ) . to eq 'yn'
200+ expect ( subject . current_packages . last . version ) . to eq '2.0.0'
201+ expect ( subject . current_packages . last . license_names_from_spec ) . to eq [ 'MIT' ]
202+ expect ( subject . current_packages . last . homepage ) . to eq 'sindresorhus.com'
203+ expect ( subject . current_packages . last . authors ) . to eq 'Sindre Sorhus'
204+ expect ( subject . current_packages . last . install_path ) . to eq Pathname ( root ) . join ( 'yarn_modules' , 'yn' )
181205 end
182206
183207 it 'uses node_modules as fallback for install path' do
@@ -188,7 +212,7 @@ module LicenseFinder
188212 [ yarn1_shell_command_output , '' , cmd_success ]
189213 end
190214
191- expect ( subject . current_packages . first . install_path ) . to eq Pathname ( root ) . join ( 'node_modules' , 'yn' )
215+ expect ( subject . current_packages . last . install_path ) . to eq Pathname ( root ) . join ( 'node_modules' , 'yn' )
192216 end
193217
194218 it 'displays incompatible packages with license type unknown' do
0 commit comments