-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SCP-66 Adds test suite for report service
- Loading branch information
1 parent
d4b22d3
commit b071d74
Showing
6 changed files
with
48 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { getLicensesReport } from '../src/services/report.service'; | ||
import { ScannerResults } from '../src/services/result.interfaces'; | ||
Check warning on line 2 in __tests__/report-service.test.ts
|
||
import { getLicenses, Licenses } from '../src/services/result.service'; | ||
Check warning on line 3 in __tests__/report-service.test.ts
|
||
|
||
const licenseTableTest = [ | ||
{ | ||
name: '1) report test', | ||
licenses: [{ spdxid: 'MIT', url: null, copyleft: null }], | ||
output: '| License | Copyleft | URL |\n| ------- | -------- | --- |\n| MIT | :x: | |\n' | ||
}, | ||
{ | ||
name: '2) report test', | ||
licenses: [ | ||
{ spdxid: 'MIT', url: null, copyleft: null }, | ||
{ spdxid: 'Apache-2.0', url: null, copyleft: null }, | ||
{ spdxid: '0BSD', url: null, copyleft: null } | ||
], | ||
output: | ||
'| License | Copyleft | URL |\n| ------- | -------- | --- |\n| MIT | :x: | |\n| Apache-2.0 | :x: | |\n| 0BSD | :x: | |\n' | ||
}, | ||
{ | ||
name: '3) report test', | ||
licenses: [ | ||
{ spdxid: 'GPL-2.0-only', url: 'https://spdx.org/licenses/GPL-2.0-only.html', copyleft: true }, | ||
{ spdxid: 'GPL-2.0-or-later', url: 'https://spdx.org/licenses/GPL-2.0-or-later.html', copyleft: true }, | ||
{ spdxid: 'JSON', url: 'https://spdx.org/licenses/JSON.html', copyleft: null }, | ||
{ spdxid: 'LicenseRef-scancode-unknown-license-reference', url: null, copyleft: null } | ||
], | ||
output: | ||
'| License | Copyleft | URL |\n| ------- | -------- | --- |\n| GPL-2.0-only | :heavy_check_mark: | https://spdx.org/licenses/GPL-2.0-only.html |\n| GPL-2.0-or-later | :heavy_check_mark: | https://spdx.org/licenses/GPL-2.0-or-later.html |\n| JSON | :x: | https://spdx.org/licenses/JSON.html |\n| LicenseRef-scancode-unknown-license-reference | :x: | |\n' | ||
} | ||
]; | ||
|
||
describe('Test report service', () => { | ||
for (const t of licenseTableTest) { | ||
it(`${t.name}`, () => { | ||
const report = getLicensesReport(t.licenses); | ||
expect(report).toEqual(t.output); | ||
}); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters