Skip to content

Commit 6e5f968

Browse files
Amal Husseinclaudiahdz
Amal Hussein
authored andcommitted
feat(docs): adding tests and updating docs to reflect changes in registry teams API. The default developers team can not longer be removed
PR-URL: #457 Credit: @nomadtechie Close: #457 Reviewed-by: @claudiahdz
1 parent 246f520 commit 6e5f968

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

docs/content/cli-commands/npm-team.md

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ Used to manage teams in organizations, and change team memberships. Does not
2828
handle permissions for packages.
2929

3030
Teams must always be fully qualified with the organization/scope they belong to
31-
when operating on them, separated by a colon (`:`). That is, if you have a
32-
`developers` team on a `foo` organization, you must always refer to that team as `foo:developers` in these commands.
31+
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.
3332

3433
* create / destroy:
35-
Create a new team, or destroy an existing one.
36-
34+
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>
3735
* add / rm:
3836
Add a user to an existing team, or remove a user from a team they belong to.
3937

test/tap/team.js

+23
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,29 @@ test('team destroy', function (t) {
8888
})
8989
})
9090

91+
test('team destroy is not allowed for the default developers team', (t) => {
92+
const teamData = {
93+
name: 'developers',
94+
scope_id: 1234,
95+
created: '2015-07-23T18:07:49.959Z',
96+
updated: '2015-07-23T18:07:49.959Z',
97+
deleted: '2015-07-23T18:27:27.178Z'
98+
}
99+
server.delete('/-/team/myorg/' + teamData.name).reply(405, teamData)
100+
common.npm([
101+
'team', 'destroy', 'myorg:' + teamData.name,
102+
'--registry', common.registry,
103+
'--loglevel', 'silent',
104+
'--json'
105+
], {}, function (err, code, stdout, stderr) {
106+
t.ifError(err, 'npm team')
107+
t.equal(code, 1, 'exited with code 1')
108+
t.equal(stderr, '', 'no error output')
109+
t.match(JSON.parse(stdout), {error: {code: 'E405'}})
110+
t.end()
111+
})
112+
})
113+
91114
test('team add', function (t) {
92115
var user = 'zkat'
93116
server.put('/-/team/myorg/myteam/user', JSON.stringify({

0 commit comments

Comments
 (0)