Skip to content

Commit

Permalink
access: ls-collaborators is ok with non-scoped (npm#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat authored and aeschright committed Feb 14, 2019
1 parent 87d801e commit 7e7a09d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/access.js
Expand Up @@ -154,7 +154,7 @@ access['ls-packages'] = access.lsPackages = ([owner], opts) => {
}

access['ls-collaborators'] = access.lsCollaborators = ([pkg, usr], opts) => {
return getPackage(pkg).then(pkgName =>
return getPackage(pkg, false).then(pkgName =>
libaccess.lsCollaborators(pkgName, usr, opts)
).then(collabs => {
// TODO - print these out nicely (breaking change)
Expand Down
28 changes: 28 additions & 0 deletions test/tap/access.js
Expand Up @@ -469,6 +469,34 @@ test('npm access ls-collaborators on package', function (t) {
)
})

test('npm access ls-collaborators on unscoped', function (t) {
var serverCollaborators = {
'myorg:myteam': 'write',
'myorg:anotherteam': 'read'
}
var clientCollaborators = {
'myorg:myteam': 'read-write',
'myorg:anotherteam': 'read-only'
}
server.get(
'/-/package/pkg/collaborators?format=cli'
).reply(200, serverCollaborators)
common.npm(
[
'access',
'ls-collaborators',
'pkg',
'--registry', common.registry
],
{ cwd: pkg },
function (er, code, stdout, stderr) {
t.ifError(er, 'npm access ls-collaborators')
t.same(JSON.parse(stdout), clientCollaborators)
t.end()
}
)
})

test('npm access ls-collaborators on current w/user filter', function (t) {
var serverCollaborators = {
'myorg:myteam': 'write',
Expand Down

0 comments on commit 7e7a09d

Please sign in to comment.