Skip to content

Commit

Permalink
test(backend): perform administrative operations as root
Browse files Browse the repository at this point in the history
  • Loading branch information
zyoshoka committed Mar 27, 2024
1 parent 6455669 commit 5487374
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions packages/backend/test/e2e/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,14 @@ describe('Note', () => {
value: true,
},
} as any,
}, alice);
}, root);

assert.strictEqual(res.status, 200);

const assign = await api('admin/roles/assign', {
userId: alice.id,
roleId: res.body.id,
}, alice);
}, root);

assert.strictEqual(assign.status, 204);
assert.strictEqual(file.body!.isSensitive, false);
Expand Down Expand Up @@ -510,11 +510,11 @@ describe('Note', () => {
await api('admin/roles/unassign', {
userId: alice.id,
roleId: res.body.id,
});
}, root);

await api('admin/roles/delete', {
roleId: res.body.id,
}, alice);
}, root);
});
});

Expand Down Expand Up @@ -646,7 +646,7 @@ describe('Note', () => {
sensitiveWords: [
'test',
],
}, alice);
}, root);

assert.strictEqual(sensitive.status, 204);

Expand All @@ -665,7 +665,7 @@ describe('Note', () => {
sensitiveWords: [
'/Test/i',
],
}, alice);
}, root);

assert.strictEqual(sensitive.status, 204);

Expand All @@ -682,7 +682,7 @@ describe('Note', () => {
sensitiveWords: [
'Test hoge',
],
}, alice);
}, root);

assert.strictEqual(sensitive.status, 204);

Expand All @@ -699,7 +699,7 @@ describe('Note', () => {
prohibitedWords: [
'test',
],
}, alice);
}, root);

assert.strictEqual(prohibited.status, 204);

Expand All @@ -718,7 +718,7 @@ describe('Note', () => {
prohibitedWords: [
'/Test/i',
],
}, alice);
}, root);

assert.strictEqual(prohibited.status, 204);

Expand All @@ -735,7 +735,7 @@ describe('Note', () => {
prohibitedWords: [
'Test hoge',
],
}, alice);
}, root);

assert.strictEqual(prohibited.status, 204);

Expand All @@ -752,7 +752,7 @@ describe('Note', () => {
prohibitedWords: [
'test',
],
}, alice);
}, root);

assert.strictEqual(prohibited.status, 204);

Expand Down Expand Up @@ -787,7 +787,7 @@ describe('Note', () => {
value: 0,
},
} as any,
}, alice);
}, root);

assert.strictEqual(res.status, 200);

Expand All @@ -796,7 +796,7 @@ describe('Note', () => {
const assign = await api('admin/roles/assign', {
userId: alice.id,
roleId: res.body.id,
}, alice);
}, root);

assert.strictEqual(assign.status, 204);

Expand All @@ -812,11 +812,11 @@ describe('Note', () => {
await api('admin/roles/unassign', {
userId: alice.id,
roleId: res.body.id,
});
}, root);

await api('admin/roles/delete', {
roleId: res.body.id,
}, alice);
}, root);
});

test('ダイレクト投稿もエラーになる', async () => {
Expand All @@ -841,7 +841,7 @@ describe('Note', () => {
value: 0,
},
} as any,
}, alice);
}, root);

assert.strictEqual(res.status, 200);

Expand All @@ -850,7 +850,7 @@ describe('Note', () => {
const assign = await api('admin/roles/assign', {
userId: alice.id,
roleId: res.body.id,
}, alice);
}, root);

assert.strictEqual(assign.status, 204);

Expand All @@ -868,11 +868,11 @@ describe('Note', () => {
await api('admin/roles/unassign', {
userId: alice.id,
roleId: res.body.id,
});
}, root);

await api('admin/roles/delete', {
roleId: res.body.id,
}, alice);
}, root);
});

test('ダイレクトの宛先とメンションが同じ場合は重複してカウントしない', async () => {
Expand All @@ -897,7 +897,7 @@ describe('Note', () => {
value: 1,
},
} as any,
}, alice);
}, root);

assert.strictEqual(res.status, 200);

Expand All @@ -906,7 +906,7 @@ describe('Note', () => {
const assign = await api('admin/roles/assign', {
userId: alice.id,
roleId: res.body.id,
}, alice);
}, root);

assert.strictEqual(assign.status, 204);

Expand All @@ -923,11 +923,11 @@ describe('Note', () => {
await api('admin/roles/unassign', {
userId: alice.id,
roleId: res.body.id,
});
}, root);

await api('admin/roles/delete', {
roleId: res.body.id,
}, alice);
}, root);
});
});

Expand Down

0 comments on commit 5487374

Please sign in to comment.