diff options
author | Gar <gar+gh@danger.computer> | 2022-04-01 19:17:01 +0300 |
---|---|---|
committer | Gar <wraithgar@github.com> | 2022-04-04 21:35:15 +0300 |
commit | ef2a8a312f0f6784a84c7f4659ef2601a650d04e (patch) | |
tree | f0a0d927d24ecb4b52a02f40a0c5f8a6ab47f249 /test/fixtures | |
parent | 47438ff19f4b6e84a0325ed73b97999ce34bc789 (diff) |
chore: remove get-idendity mock from whoami tests
Diffstat (limited to 'test/fixtures')
-rw-r--r-- | test/fixtures/mock-registry.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/fixtures/mock-registry.js b/test/fixtures/mock-registry.js index ec4ebc2a4..34969b65f 100644 --- a/test/fixtures/mock-registry.js +++ b/test/fixtures/mock-registry.js @@ -23,6 +23,9 @@ class MockRegistry { get nock () { if (!this.#nock) { + if (!this.#tap) { + throw new Error('cannot mock packages without a tap fixture') + } const tnock = require('./tnock.js') const reqheaders = {} if (this.#authorization) { @@ -37,11 +40,12 @@ class MockRegistry { this.#nock = nock } + async whoami ({ username }) { + this.nock.get('/-/whoami').reply(200, { username }) + } + async package ({ manifest, times = 1, query, tarballs }) { let nock = this.nock - if (!nock) { - throw new Error('cannot mock packages without a tap fixture') - } nock = nock.get(`/${manifest.name}`).times(times) if (query) { nock = nock.query(query) |