@@ -274,24 +274,53 @@ test('getLicenseAndAuthorFromVersions', () => {
274
274
'_npmUser' : {
275
275
name : 'finn' ,
276
276
email : 'finn.pauls@gmail.com'
277
+ }
278
+ } ,
279
+ '2.2.2' : {
280
+ 'repository' : {
281
+ 'type' : 'git' ,
282
+ 'url' : 'git+https://github.com/best/best.git'
277
283
} ,
278
- '2.2.2' : {
279
- 'repository' : {
280
- 'type' : 'git' ,
281
- 'url' : 'git+https://github.com/best/best.git'
282
- } ,
283
- 'license' : 'MIT' ,
284
- '_npmUser' : {
285
- name : 'finn' ,
286
- email : 'finn.pauls@gmail.com'
287
- }
284
+ 'license' : 'MIT' ,
285
+ '_npmUser' : {
286
+ name : 'finn' ,
287
+ email : 'finn.pauls@gmail.com'
288
288
}
289
289
}
290
290
}
291
291
const output = getLicenseAndAuthorFromVersions ( { versions, version, oldVersionResolved } )
292
- console . log ( '### output' , output )
293
- // returns the last satisfying version
294
- expect ( output ) . toEqual ( '9.3.1' )
292
+ expect ( output ) . toMatchObject ( { license : 'MIT' , licenseHasChanged : false , publisher : 'finn' } )
293
+ } )
294
+
295
+ test ( 'getLicenseAndAuthorFromVersions with changed license' , ( ) => {
296
+ const version = '2.2.2'
297
+ const oldVersionResolved = '1.1.1'
298
+ const versions = {
299
+ '1.1.1' : {
300
+ 'repository' : {
301
+ 'type' : 'git' ,
302
+ 'url' : 'git+https://github.com/cat/cat.git'
303
+ } ,
304
+ 'license' : 'MIT' ,
305
+ '_npmUser' : {
306
+ name : 'finn' ,
307
+ email : 'finn.pauls@gmail.com'
308
+ }
309
+ } ,
310
+ '2.2.2' : {
311
+ 'repository' : {
312
+ 'type' : 'git' ,
313
+ 'url' : 'git+https://github.com/best/best.git'
314
+ } ,
315
+ 'license' : 'kitty' ,
316
+ '_npmUser' : {
317
+ name : 'finn' ,
318
+ email : 'finn.pauls@gmail.com'
319
+ }
320
+ }
321
+ }
322
+ const output = getLicenseAndAuthorFromVersions ( { versions, version, oldVersionResolved } )
323
+ expect ( output ) . toMatchObject ( { license : 'kitty' , licenseHasChanged : true , publisher : 'finn' } )
295
324
} )
296
325
297
326
test ( 'Use default env.GITHUB_URL in github compare URL' , ( ) => {
0 commit comments