Skip to content

Commit efb8375

Browse files
committed
Documentation changes
1 parent f79bd90 commit efb8375

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

app/manage/permissions/create-org-team.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { isOwner, isManager } = require('../../lib/organization')
99
* @param {int} uid - user id
1010
* @param {Object} params - request parameters
1111
* @param {int} params.id - organization id
12-
* @returns {boolean}
12+
* @returns {Promise<boolean>}
1313
*/
1414
async function createOrgTeam (uid, { id }) {
1515
return (await isOwner(id, uid)) || isManager(id, uid)

app/manage/permissions/edit-org.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { isOwner } = require('../../lib/organization')
99
* @param {int} uid - user id
1010
* @param {Object} params - request parameters
1111
* @param {int} params.id - organization id
12-
* @returns {boolean}
12+
* @returns {Promise<boolean>}
1313
*/
1414
async function editOrg (uid, { id }) {
1515
return isOwner(id, uid)

app/manage/permissions/edit-team.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const { isOwner } = require('../../lib/organization')
1010
*
1111
* @param {string} uid user id
1212
* @param {Object} params request parameters
13-
* @returns {boolean} can the request go through?
13+
* @returns {Promise<boolean>} can the request go through?
1414
*/
1515
async function updateTeam (uid, { id }) {
1616
// user has to be authenticated

app/tests/permissions/add-org-team.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ test('org owner can create a team', async t => {
4949

5050
let res = await agent.post('/api/organizations')
5151
.send({ name: orgName })
52-
.set('Authorization', `Bearer user100`)
52+
.set('Authorization', 'Bearer user100')
5353
.expect(200)
5454

5555
let res2 = await agent.post(`/api/organizations/${res.body.id}/teams`)
56-
.set('Authorization', `Bearer user100`)
56+
.set('Authorization', 'Bearer user100')
5757
.send({ name: teamName })
5858

5959
t.is(res2.status, 200)
@@ -71,16 +71,16 @@ test('org manager can create a team', async t => {
7171

7272
let res = await agent.post('/api/organizations')
7373
.send({ name: orgName })
74-
.set('Authorization', `Bearer user100`)
74+
.set('Authorization', 'Bearer user100')
7575
.expect(200)
7676

7777
// We create a manager role for user 101
7878
await agent.put(`/api/organizations/${res.body.id}/addManager/101`)
79-
.set('Authorization', `Bearer user100`)
79+
.set('Authorization', 'Bearer user100')
8080
.expect(200)
8181

8282
let res2 = await agent.post(`/api/organizations/${res.body.id}/teams`)
83-
.set('Authorization', `Bearer user101`)
83+
.set('Authorization', 'Bearer user101')
8484
.send({ name: teamName })
8585

8686
t.is(res2.status, 200)
@@ -98,11 +98,11 @@ test('non-org manager cannot create a team', async t => {
9898

9999
let res = await agent.post('/api/organizations')
100100
.send({ name: orgName })
101-
.set('Authorization', `Bearer user100`)
101+
.set('Authorization', 'Bearer user100')
102102
.expect(200)
103103

104104
let res2 = await agent.post(`/api/organizations/${res.body.id}/teams`)
105-
.set('Authorization', `Bearer user101`)
105+
.set('Authorization', 'Bearer user101')
106106
.send({ name: teamName })
107107

108108
t.is(res2.status, 401)

app/tests/permissions/join-team.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,28 @@ test.after.always(async () => {
4444
test('a user can join a public team', async t => {
4545
const team = t.context.publicTeam
4646
let res = await agent.put(`/api/teams/${team.id}/join`)
47-
.set('Authorization', `Bearer user101`)
47+
.set('Authorization', 'Bearer user101')
4848
t.is(res.status, 200)
4949
})
5050

5151
test('a user cannot join a private team', async t => {
5252
const team = t.context.privateTeam
5353
let res = await agent.put(`/api/teams/${team.id}/join`)
54-
.set('Authorization', `Bearer user101`)
54+
.set('Authorization', 'Bearer user101')
5555
t.is(res.status, 401)
5656
})
5757

5858
test('a user cannot join a team they are already in', async t => {
5959
const team = t.context.publicTeam
6060
let res = await agent.put(`/api/teams/${team.id}/join`)
61-
.set('Authorization', `Bearer user100`)
61+
.set('Authorization', 'Bearer user100')
6262
t.is(res.status, 401)
6363
})
6464

6565
test('a user must be authenticated to join a team', async t => {
6666
const team = t.context.publicTeam
6767
let invalidToken = await agent.put(`/api/teams/${team.id}/join`)
68-
.set('Authorization', `Bearer invalidToken`)
68+
.set('Authorization', 'Bearer invalidToken')
6969
t.is(invalidToken.status, 401)
7070
let unauthenticated = await agent.put(`/api/teams/${team.id}/join`)
7171
t.is(unauthenticated.status, 401)

app/tests/permissions/update-team.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ test.after.always(async () => {
3939
test('a team moderator can update a team', async t => {
4040
let res = await agent.post('/api/teams')
4141
.send({ name: 'road team 1' })
42-
.set('Authorization', `Bearer user100`)
42+
.set('Authorization', 'Bearer user100')
4343
.expect(200)
4444

4545
let res2 = await agent.put(`/api/teams/${res.body.id}`)
46-
.set('Authorization', `Bearer user100`)
46+
.set('Authorization', 'Bearer user100')
4747
.send({ name: 'building team 1' })
4848

4949
t.is(res2.status, 200)
@@ -52,11 +52,11 @@ test('a team moderator can update a team', async t => {
5252
test('a non-team moderator cannot update a team', async t => {
5353
let res = await agent.post('/api/teams')
5454
.send({ name: 'road team 2' })
55-
.set('Authorization', `Bearer user100`)
55+
.set('Authorization', 'Bearer user100')
5656
.expect(200)
5757

5858
let res2 = await agent.put(`/api/teams/${res.body.id}`)
59-
.set('Authorization', `Bearer user101`)
59+
.set('Authorization', 'Bearer user101')
6060
.send({ name: 'building team 2' })
6161

6262
t.is(res2.status, 401)
@@ -66,24 +66,24 @@ test('an org team can be updated by the the org manager', async t => {
6666
// Let's create an organization, user100 is the owner
6767
const res = await agent.post('/api/organizations')
6868
.send({ name: 'org manager can update team' })
69-
.set('Authorization', `Bearer user100`)
69+
.set('Authorization', 'Bearer user100')
7070
.expect(200)
7171

7272
// Let's set user101 to be a manager of this organization and create a
7373
// team in the organization
7474
await agent.put(`/api/organizations/${res.body.id}/addManager/101`)
75-
.set('Authorization', `Bearer user100`)
75+
.set('Authorization', 'Bearer user100')
7676
.expect(200)
7777

7878
const res2 = await agent.post(`/api/organizations/${res.body.id}/teams`)
7979
.send({ name: 'org team can be updated by manager - team' })
80-
.set('Authorization', `Bearer user101`)
80+
.set('Authorization', 'Bearer user101')
8181
.expect(200)
8282

8383
// Use the manager to update the team
8484
const res3 = await agent.put(`/api/teams/${res2.body.id}`)
8585
.send({ name: 'org team can be updated by manager - team2' })
86-
.set('Authorization', `Bearer user101`)
86+
.set('Authorization', 'Bearer user101')
8787

8888
t.is(res3.status, 200)
8989
})
@@ -92,25 +92,25 @@ test('an org team can be updated by the owner of the org', async t => {
9292
// Let's create an organization, user100 is the owner
9393
const res = await agent.post('/api/organizations')
9494
.send({ name: 'org owner can update team' })
95-
.set('Authorization', `Bearer user100`)
95+
.set('Authorization', 'Bearer user100')
9696
.expect(200)
9797

9898
// Let's set user101 to be a manager of this organization and create a
9999
// team in the organization
100100
await agent.put(`/api/organizations/${res.body.id}/addManager/101`)
101-
.set('Authorization', `Bearer user100`)
101+
.set('Authorization', 'Bearer user100')
102102
.expect(200)
103103

104104
const res2 = await agent.post(`/api/organizations/${res.body.id}/teams`)
105105
.send({ name: 'org team can be updated by owner - team' })
106-
.set('Authorization', `Bearer user101`)
106+
.set('Authorization', 'Bearer user101')
107107
.expect(200)
108108

109109
// user101 is the moderator and manager, but user100 should be able
110110
// to edit this team
111111
const res3 = await agent.put(`/api/teams/${res2.body.id}`)
112112
.send({ name: 'org team can be updated by owner - team2' })
113-
.set('Authorization', `Bearer user100`)
113+
.set('Authorization', 'Bearer user100')
114114

115115
t.is(res3.status, 200)
116116
})

0 commit comments

Comments
 (0)