forked from actions/dependency-review-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nigel brown <[email protected]>
- Loading branch information
Showing
5 changed files
with
365 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import { | |
ConfigurationOptions, | ||
ConfigurationOptionsSchema | ||
} from '../src/schemas' | ||
import {getTrustyScores} from '../src/trusty' | ||
import {aggregateChanges, getTrustyScores} from '../src/trusty' | ||
|
||
const nonExistChange: Change = { | ||
manifest: 'package.json', | ||
|
@@ -66,6 +66,32 @@ const pipChange: Change = { | |
] | ||
} | ||
|
||
const pipV1Change: Change = { | ||
change_type: 'removed', | ||
manifest: 'requirements.txt', | ||
ecosystem: 'pip', | ||
name: 'pandas', | ||
version: '1.1.1', | ||
package_url: 'pkg:pypi/[email protected]', | ||
license: 'MIT', | ||
source_repository_url: 'github.com/some-repo', | ||
scope: 'runtime', | ||
vulnerabilities: [] | ||
} | ||
|
||
const pipV2Change: Change = { | ||
change_type: 'added', | ||
manifest: 'requirements.txt', | ||
ecosystem: 'pip', | ||
name: 'pandas', | ||
version: '1.1.2', | ||
package_url: 'pkg:pypi/[email protected]', | ||
license: 'MIT', | ||
source_repository_url: 'github.com/some-repo', | ||
scope: 'runtime', | ||
vulnerabilities: [] | ||
} | ||
|
||
const mavenChange: Change = { | ||
change_type: 'added', | ||
manifest: 'pom.xml', | ||
|
@@ -138,3 +164,16 @@ test('Test bad list', async () => { | |
expect(changed).toHaveLength(changes.length) | ||
expect(changed[0].trusty?.score).toBeGreaterThan(0) | ||
}) | ||
|
||
test('Test update', async () => { | ||
const changes: Changes = [ | ||
npmChange, | ||
pipV2Change, | ||
mavenChange, | ||
nonExistChange, | ||
pipV1Change | ||
] | ||
const updates = aggregateChanges(changes) | ||
expect(updates[0]).not.toBeNull() | ||
expect(updates).toHaveLength(changes.length - 1) | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.