Skip to content

Commit

Permalink
Uncomment tests
Browse files Browse the repository at this point in the history
  • Loading branch information
disulliv committed Mar 17, 2021
1 parent 5094019 commit 91bd6d7
Showing 1 changed file with 69 additions and 69 deletions.
138 changes: 69 additions & 69 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,52 +7,52 @@ const { expect } = require('chai')
describe('SPDX utility functions', () => {
it('parses spdx expressions', () => {
const data = new Map([
// [{ license: 'MIT' }, { license: 'MIT' }],
// ['MIT', { license: 'MIT' }],
// ['mit', { license: 'MIT' }],
// ['MIT ', { license: 'MIT' }],
// [' MIT', { license: 'MIT' }],
[{ license: 'MIT' }, { license: 'MIT' }],
['MIT', { license: 'MIT' }],
['mit', { license: 'MIT' }],
['MIT ', { license: 'MIT' }],
[' MIT', { license: 'MIT' }],
['Other', { license: 'OTHER' }],
// ['MIT OR Apache-2.0', { left: { license: 'MIT' }, conjunction: 'or', right: { license: 'Apache-2.0' } }],
// ['MIT AND Apache-2.0', { left: { license: 'MIT' }, conjunction: 'and', right: { license: 'Apache-2.0' } }],
// [
// 'MIT OR (BSD-2-Clause AND GPL-2.0)',
// {
// left: { license: 'MIT' },
// conjunction: 'or',
// right: { left: { license: 'BSD-2-Clause' }, conjunction: 'and', right: { license: 'GPL-2.0' } }
// }
// ],
// [
// 'MIT OR BSD-2-Clause OR (BSD-3-Clause AND Unlicense)',
// {
// left: { license: 'MIT' },
// conjunction: 'or',
// right: {
// left: { license: 'BSD-2-Clause' },
// conjunction: 'or',
// right: { left: { license: 'BSD-3-Clause' }, conjunction: 'and', right: { license: 'Unlicense' } }
// }
// }
// ],
// [
// 'MIT AND BSD-3-Clause WITH GCC-exception-3.1 OR (CC-BY-4.0 AND Apache-2.0)',
// {
// left: {
// left: { license: 'MIT' },
// conjunction: 'and',
// right: { license: 'BSD-3-Clause', exception: 'GCC-exception-3.1' }
// },
// conjunction: 'or',
// right: {
// left: { license: 'CC-BY-4.0' },
// conjunction: 'and',
// right: { license: 'Apache-2.0' }
// }
// }
// ],
// ['Apache-2.0 WITH Autoconf-exception-2.0', { license: 'Apache-2.0', exception: 'Autoconf-exception-2.0' }],
// ['Apache-2.0 WITH commons-clause', { license: 'Apache-2.0', exception: 'NOASSERTION' }]
['MIT OR Apache-2.0', { left: { license: 'MIT' }, conjunction: 'or', right: { license: 'Apache-2.0' } }],
['MIT AND Apache-2.0', { left: { license: 'MIT' }, conjunction: 'and', right: { license: 'Apache-2.0' } }],
[
'MIT OR (BSD-2-Clause AND GPL-2.0)',
{
left: { license: 'MIT' },
conjunction: 'or',
right: { left: { license: 'BSD-2-Clause' }, conjunction: 'and', right: { license: 'GPL-2.0' } }
}
],
[
'MIT OR BSD-2-Clause OR (BSD-3-Clause AND Unlicense)',
{
left: { license: 'MIT' },
conjunction: 'or',
right: {
left: { license: 'BSD-2-Clause' },
conjunction: 'or',
right: { left: { license: 'BSD-3-Clause' }, conjunction: 'and', right: { license: 'Unlicense' } }
}
}
],
[
'MIT AND BSD-3-Clause WITH GCC-exception-3.1 OR (CC-BY-4.0 AND Apache-2.0)',
{
left: {
left: { license: 'MIT' },
conjunction: 'and',
right: { license: 'BSD-3-Clause', exception: 'GCC-exception-3.1' }
},
conjunction: 'or',
right: {
left: { license: 'CC-BY-4.0' },
conjunction: 'and',
right: { license: 'Apache-2.0' }
}
}
],
['Apache-2.0 WITH Autoconf-exception-2.0', { license: 'Apache-2.0', exception: 'Autoconf-exception-2.0' }],
['Apache-2.0 WITH commons-clause', { license: 'Apache-2.0', exception: 'NOASSERTION' }]
])

data.forEach((expected, input) => {
Expand Down Expand Up @@ -191,32 +191,32 @@ describe('SPDX utility functions', () => {
it('normalizes spdx expressions', () => {
// prettier-ignore
const data = {
// 'AGPL-1.0': 'AGPL-1.0',
// 'apache-2.0': 'Apache-2.0',
// 'apache2': 'NOASSERTION',
// 'GPL-': 'NOASSERTION',
// 'GPL-2.0-with-autoconf-exception': 'GPL-2.0-with-autoconf-exception',
// 'GPL-3.0': 'GPL-3.0',
// 'GPL': 'NOASSERTION',
// 'mit': 'MIT',
// 'MIT ': 'MIT',
// ' MIT': 'MIT',
// 'GPL-1.0+': 'GPL-1.0+',
'AGPL-1.0': 'AGPL-1.0',
'apache-2.0': 'Apache-2.0',
'apache2': 'NOASSERTION',
'GPL-': 'NOASSERTION',
'GPL-2.0-with-autoconf-exception': 'GPL-2.0-with-autoconf-exception',
'GPL-3.0': 'GPL-3.0',
'GPL': 'NOASSERTION',
'mit': 'MIT',
'MIT ': 'MIT',
' MIT': 'MIT',
'GPL-1.0+': 'GPL-1.0+',
'OTHER': 'OTHER',
'other': 'OTHER',
// 'Apache-2.0 WITH commons-clause': 'NOASSERTION',
// 'NOASSERTION': 'NOASSERTION',
// 'See license': 'NOASSERTION',
// 'MIT OR Apache-2.0': 'MIT OR Apache-2.0',
// 'MIT AND LGPL-2.1+ AND BSD-3-Clause': 'MIT AND LGPL-2.1+ AND BSD-3-Clause',
// '(MIT AND BSD-3-Clause WITH GCC-exception-3.1) OR (CC-BY-4.0 AND Apache-2.0)': 'MIT AND BSD-3-Clause WITH GCC-exception-3.1 OR CC-BY-4.0 AND Apache-2.0',
// 'MIT AND BSD-3-Clause AND CC-BY-4.0': 'MIT AND BSD-3-Clause AND CC-BY-4.0',
// 'MIT OR Junk': 'MIT OR NOASSERTION',
// 'mit OR Junk': 'MIT OR NOASSERTION',
// 'Commercial AND Apache-2.0': 'NOASSERTION AND Apache-2.0',
// 'Junk1 OR Junk 2': 'NOASSERTION',
// ' ': null,
// null: null
'Apache-2.0 WITH commons-clause': 'NOASSERTION',
'NOASSERTION': 'NOASSERTION',
'See license': 'NOASSERTION',
'MIT OR Apache-2.0': 'MIT OR Apache-2.0',
'MIT AND LGPL-2.1+ AND BSD-3-Clause': 'MIT AND LGPL-2.1+ AND BSD-3-Clause',
'(MIT AND BSD-3-Clause WITH GCC-exception-3.1) OR (CC-BY-4.0 AND Apache-2.0)': 'MIT AND BSD-3-Clause WITH GCC-exception-3.1 OR CC-BY-4.0 AND Apache-2.0',
'MIT AND BSD-3-Clause AND CC-BY-4.0': 'MIT AND BSD-3-Clause AND CC-BY-4.0',
'MIT OR Junk': 'MIT OR NOASSERTION',
'mit OR Junk': 'MIT OR NOASSERTION',
'Commercial AND Apache-2.0': 'NOASSERTION AND Apache-2.0',
'Junk1 OR Junk 2': 'NOASSERTION',
' ': null,
null: null
}
for (let input of Object.keys(data)) {
if (input === 'null') input = null
Expand Down

0 comments on commit 91bd6d7

Please sign in to comment.