Skip to content

Node.js based forum software built for the modern web

test: be more explicit about ownership test data

Julian Lamb628bfc7a247
diff --git a/public/openapi/write/groups/slug/ownership/uid.yaml b/public/openapi/write/groups/slug/ownership/uid.yaml
index a13c31d12f..b0746cdbd8 100644
--- a/public/openapi/write/groups/slug/ownership/uid.yaml
+++ b/public/openapi/write/groups/slug/ownership/uid.yaml
@@ -10,14 +10,14 @@ put:
type: string
required: true
description: slug of the group you would like to grant ownership
- example: test-group
+ example: ownership-only
- in: path
name: uid
schema:
type: number
required: true
description: uid of the user to grant ownership
- example: 2
+ example: 11
responses:
'200':
description: ownership successfully granted
@@ -43,14 +43,14 @@ delete:
type: string
required: true
description: slug of the group you would like to rescind ownership
- example: test-group
+ example: ownership-only
- in: path
name: uid
schema:
type: number
required: true
description: uid of the user to rescind ownership from
- example: 2
+ example: 11
responses:
'200':
description: ownership successfully rescinded
diff --git a/test/api/schema.js b/test/api/schema.js
index b195b20480..868b5c18f4 100644
--- a/test/api/schema.js
+++ b/test/api/schema.js
@@ -217,14 +217,11 @@ async function setupData() {
await groups.create({
name: 'Test Group',
});
- await Promise.all([
- groups.join('Test Group', unprivUid),
- groups.join('Test Group', emailConfirmationUid),
- ]);
- await groups.ownership.grant(emailConfirmationUid, 'Test Group');
- // Create private groups for pending/invitations
- const [pending1, pending2, inviteUid] = await Promise.all([
+ // Create users for pending/invitations/ownership
+ const [pending1, pending2, inviteUid, owner1Uid, owner2Uid] = await Promise.all([
+ user.create({ username: utils.generateUUID().slice(0, 8) }),
+ user.create({ username: utils.generateUUID().slice(0, 8) }),
user.create({ username: utils.generateUUID().slice(0, 8) }),
user.create({ username: utils.generateUUID().slice(0, 8) }),
user.create({ username: utils.generateUUID().slice(0, 8) }),
@@ -232,10 +229,15 @@ async function setupData() {
mocks.put['/groups/{slug}/pending/{uid}'][1].example = pending1;
mocks.delete['/groups/{slug}/pending/{uid}'][1].example = pending2;
mocks.delete['/groups/{slug}/invites/{uid}'][1].example = inviteUid;
- await Promise.all(['private-group', 'invitations-only'].map(async (name) => groups.create({ name, private: true })));
+ await Promise.all(['private-group', 'invitations-only', 'ownership-only'].map(async (name) => groups.create({ name, private: true })));
await groups.requestMembership('private-group', pending1);
await groups.requestMembership('private-group', pending2);
await groups.invite('invitations-only', inviteUid);
+ await Promise.all([
+ groups.join('ownership-only', owner1Uid),
+ groups.join('ownership-only', owner2Uid),
+ ]);
+ await groups.ownership.grant(owner2Uid, 'ownership-only');
await meta.settings.set('core.api', {
tokens: [{