Fix type issues
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
import {expect, jest, test} from '@jest/globals'
|
||||||
|
import {Change, Changes, Scorecard} from '../src/schemas'
|
||||||
|
import {getScorecardLevels} from '../src/scorecard'
|
||||||
|
|
||||||
|
const npmChange: Change = {
|
||||||
|
manifest: 'package.json',
|
||||||
|
change_type: 'added',
|
||||||
|
ecosystem: 'npm',
|
||||||
|
name: 'type-is',
|
||||||
|
version: '1.6.18',
|
||||||
|
package_url: 'pkg:npm/[email protected]',
|
||||||
|
license: 'MIT',
|
||||||
|
source_repository_url: 'github.com/jshttp/type-is',
|
||||||
|
scope: 'runtime',
|
||||||
|
vulnerabilities: [
|
||||||
|
{
|
||||||
|
severity: 'critical',
|
||||||
|
advisory_ghsa_id: 'first-random_string',
|
||||||
|
advisory_summary: 'very dangerous',
|
||||||
|
advisory_url: 'github.com/future-funk'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
test('Can download data from deps.dev', async () => {
|
||||||
|
const changes: Changes = [npmChange]
|
||||||
|
const scorecard = await getScorecardLevels(changes)
|
||||||
|
expect(scorecard).not.toBeNull()
|
||||||
|
})
|
||||||
+1
-1
@@ -1030,7 +1030,7 @@ const schemas_1 = __nccwpck_require__(8774);
|
|||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
function getScorecardLevels(changes) {
|
function getScorecardLevels(changes) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const data = {};
|
const data = { dependencies: [] };
|
||||||
for (const change of changes) {
|
for (const change of changes) {
|
||||||
try {
|
try {
|
||||||
const ecosystem = change.ecosystem;
|
const ecosystem = change.ecosystem;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-2
@@ -13,7 +13,7 @@ import * as core from '@actions/core'
|
|||||||
export async function getScorecardLevels(
|
export async function getScorecardLevels(
|
||||||
changes: Change[]
|
changes: Change[]
|
||||||
): Promise<Scorecard> {
|
): Promise<Scorecard> {
|
||||||
const data: Scorecard = {} as Scorecard
|
const data: Scorecard = {dependencies: []} as Scorecard
|
||||||
for (const change of changes) {
|
for (const change of changes) {
|
||||||
try {
|
try {
|
||||||
const ecosystem = change.ecosystem
|
const ecosystem = change.ecosystem
|
||||||
@@ -24,7 +24,6 @@ export async function getScorecardLevels(
|
|||||||
packageName,
|
packageName,
|
||||||
version
|
version
|
||||||
)
|
)
|
||||||
|
|
||||||
data.dependencies.push({
|
data.dependencies.push({
|
||||||
ecosystem,
|
ecosystem,
|
||||||
packageName,
|
packageName,
|
||||||
|
|||||||
Reference in New Issue
Block a user