Fix type issues

This commit is contained in:
Justin Hutchings
2024-03-03 06:50:11 +00:00
parent c286ea91b0
commit 2bc3ecb19b
4 changed files with 32 additions and 4 deletions
+29
View File
@@ -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/type-is@1.6.18',
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()
})
Generated Vendored
+1 -1
View File
@@ -1030,7 +1030,7 @@ const schemas_1 = __nccwpck_require__(8774);
const core = __importStar(__nccwpck_require__(2186));
function getScorecardLevels(changes) {
return __awaiter(this, void 0, void 0, function* () {
const data = {};
const data = { dependencies: [] };
for (const change of changes) {
try {
const ecosystem = change.ecosystem;
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -2
View File
@@ -13,7 +13,7 @@ import * as core from '@actions/core'
export async function getScorecardLevels(
changes: Change[]
): Promise<Scorecard> {
const data: Scorecard = {} as Scorecard
const data: Scorecard = {dependencies: []} as Scorecard
for (const change of changes) {
try {
const ecosystem = change.ecosystem
@@ -24,7 +24,6 @@ export async function getScorecardLevels(
packageName,
version
)
data.dependencies.push({
ecosystem,
packageName,