Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding tests and updating docs to reflect changes in registry teams API. The default developers team can no longer be removed #457

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/content/cli-commands/npm-team.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ handle permissions for packages.

Teams must always be fully qualified with the organization/scope they belong to
when operating on them, separated by a colon (`:`). That is, if you have a
`developers` team on a `foo` organization, you must always refer to that team as
`foo:developers` in these commands.
`wombats` team in a `wisdom` organization, you must always refer to that team as
`wisdom:wombats` in these commands.

* create / destroy:
Create a new team, or destroy an existing one.

Create a new team, or destroy an existing one. Note: You cannot remove the `developers` team, <a href="https://docs.npmjs.com/about-developers-team" target="_blank">learn more.</a>
* add / rm:
Add a user to an existing team, or remove a user from a team they belong to.

Expand Down
23 changes: 23 additions & 0 deletions test/tap/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,29 @@ test('team destroy', function (t) {
})
})

test('team destroy is not allowed for the default developers team', (t) => {
const teamData = {
name: 'developers',
scope_id: 1234,
created: '2015-07-23T18:07:49.959Z',
updated: '2015-07-23T18:07:49.959Z',
deleted: '2015-07-23T18:27:27.178Z'
}
server.delete('/-/team/myorg/' + teamData.name).reply(405, teamData)
common.npm([
'team', 'destroy', 'myorg:' + teamData.name,
'--registry', common.registry,
'--loglevel', 'silent',
'--json'
], {}, function (err, code, stdout, stderr) {
t.ifError(err, 'npm team')
t.equal(code, 1, 'exited with code 1')
t.equal(stderr, '', 'no error output')
t.match(JSON.parse(stdout), {error: {code: 'E405'}})
t.end()
})
})

test('team add', function (t) {
var user = 'zkat'
server.put('/-/team/myorg/myteam/user', JSON.stringify({
Expand Down