Skip to content

Commit

Permalink
feat(docs): adding tests and updating docs to reflect changes in regi…
Browse files Browse the repository at this point in the history
…stry teams API. The default developers team can not longer be removed

PR-URL: #457
Credit: @nomadtechie
Close: #457
Reviewed-by: @claudiahdz
  • Loading branch information
Amal Hussein authored and claudiahdz committed Nov 13, 2019
1 parent 2939de6 commit f0dceba
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
6 changes: 2 additions & 4 deletions docs/content/cli-commands/npm-team.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ Used to manage teams in organizations, and change team memberships. Does not
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.
when operating on them, separated by a colon (`:`). That is, if you have a `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

0 comments on commit f0dceba

Please # to comment.