Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixtures/mock-registry.js')
-rw-r--r--test/fixtures/mock-registry.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/fixtures/mock-registry.js b/test/fixtures/mock-registry.js
index 01d43ba3d..a62890b72 100644
--- a/test/fixtures/mock-registry.js
+++ b/test/fixtures/mock-registry.js
@@ -183,6 +183,15 @@ class MockRegistry {
}
}
+ star (manifest, users) {
+ const spec = npa(manifest.name)
+ this.nock = this.nock.put(`/${spec.escapedName}`, {
+ _id: manifest._id,
+ _rev: manifest._rev,
+ users,
+ }).reply(200, { ...manifest, users })
+ }
+
async package ({ manifest, times = 1, query, tarballs }) {
let nock = this.nock
const spec = npa(manifest.name)
@@ -206,7 +215,7 @@ class MockRegistry {
// either pass in packuments if you need to set specific attributes besides version,
// or an array of versions
// the last packument in the packuments or versions array will be tagged latest
- manifest ({ name = 'test-package', packuments, versions } = {}) {
+ manifest ({ name = 'test-package', users, packuments, versions } = {}) {
packuments = this.packuments(packuments, name)
const latest = packuments.slice(-1)[0]
const manifest = {
@@ -220,6 +229,9 @@ class MockRegistry {
'dist-tags': { latest: latest.version },
...latest,
}
+ if (users) {
+ manifest.users = users
+ }
if (versions) {
packuments = versions.map(version => ({ version }))
}