Skip to content

Commit

Permalink
test(utils): test getLicenseAndAuthorFromVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkoba authored and Realtin committed Jul 4, 2019
1 parent be97ff9 commit 61be8fa
Showing 1 changed file with 42 additions and 13 deletions.
55 changes: 42 additions & 13 deletions test/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,24 +274,53 @@ test('getLicenseAndAuthorFromVersions', () => {
'_npmUser': {
name: 'finn',
email: '[email protected]'
}
},
'2.2.2': {
'repository': {
'type': 'git',
'url': 'git+https://github.com/best/best.git'
},
'2.2.2': {
'repository': {
'type': 'git',
'url': 'git+https://github.com/best/best.git'
},
'license': 'MIT',
'_npmUser': {
name: 'finn',
email: '[email protected]'
}
'license': 'MIT',
'_npmUser': {
name: 'finn',
email: '[email protected]'
}
}
}
const output = getLicenseAndAuthorFromVersions({ versions, version, oldVersionResolved })
console.log('### output', output)
// returns the last satisfying version
expect(output).toEqual('9.3.1')
expect(output).toMatchObject({ license: 'MIT', licenseHasChanged: false, publisher: 'finn' })
})

test('getLicenseAndAuthorFromVersions with changed license', () => {
const version = '2.2.2'
const oldVersionResolved = '1.1.1'
const versions = {
'1.1.1': {
'repository': {
'type': 'git',
'url': 'git+https://github.com/cat/cat.git'
},
'license': 'MIT',
'_npmUser': {
name: 'finn',
email: '[email protected]'
}
},
'2.2.2': {
'repository': {
'type': 'git',
'url': 'git+https://github.com/best/best.git'
},
'license': 'kitty',
'_npmUser': {
name: 'finn',
email: '[email protected]'
}
}
}
const output = getLicenseAndAuthorFromVersions({ versions, version, oldVersionResolved })
expect(output).toMatchObject({ license: 'kitty', licenseHasChanged: true, publisher: 'finn' })
})

test('Use default env.GITHUB_URL in github compare URL', () => {
Expand Down

0 comments on commit 61be8fa

Please sign in to comment.