diff options
author | Gar <gar+gh@danger.computer> | 2022-04-02 02:45:01 +0300 |
---|---|---|
committer | Gar <wraithgar@github.com> | 2022-04-04 21:35:15 +0300 |
commit | edbd884f6a1f077c7b4e1b7127b0a0f14ae065a0 (patch) | |
tree | 7cc83f6226ebba70a45c0e9662f13f703a1b435c /test/fixtures | |
parent | ef2a8a312f0f6784a84c7f4659ef2601a650d04e (diff) |
chore: remove mocks from npm audit tests
Diffstat (limited to 'test/fixtures')
-rw-r--r-- | test/fixtures/mock-registry.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/test/fixtures/mock-registry.js b/test/fixtures/mock-registry.js index 34969b65f..1cbe7b52d 100644 --- a/test/fixtures/mock-registry.js +++ b/test/fixtures/mock-registry.js @@ -44,6 +44,24 @@ class MockRegistry { this.nock.get('/-/whoami').reply(200, { username }) } + advisory (advisory = {}) { + const id = advisory.id || parseInt(Math.random() * 1000000) + return { + id, + url: `https://github.com/advisories/GHSA-${id}`, + title: `Test advisory ${id}`, + severity: 'high', + vulnerable_versions: '*', + cwe: [ + 'cwe-0', + ], + cvss: { + score: 0, + }, + ...advisory, + } + } + async package ({ manifest, times = 1, query, tarballs }) { let nock = this.nock nock = nock.get(`/${manifest.name}`).times(times) @@ -52,7 +70,8 @@ class MockRegistry { } nock = nock.reply(200, manifest) if (tarballs) { - for (const version in manifest.versions) { + for (const version in tarballs) { + // for (const version in manifest.versions) { const packument = manifest.versions[version] const dist = new URL(packument.dist.tarball) const tarball = await pacote.tarball(tarballs[version]) |