2023-07-27 07:31:52 +02:00
|
|
|
/*
|
2024-02-13 16:59:27 +01:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2019-04-07 14:50:36 +02:00
|
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
|
|
|
|
import * as assert from 'assert';
|
2024-01-08 09:43:52 +01:00
|
|
|
import { api, post, react, signup, waitFire } from '../utils.js';
|
2023-06-25 01:34:18 +02:00
|
|
|
import type * as misskey from 'misskey-js';
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
describe('Mute', () => {
|
|
|
|
// alice mutes carol
|
2024-01-03 05:41:28 +01:00
|
|
|
let alice: misskey.entities.SignupResponse;
|
|
|
|
let bob: misskey.entities.SignupResponse;
|
|
|
|
let carol: misskey.entities.SignupResponse;
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2022-09-17 20:27:08 +02:00
|
|
|
beforeAll(async () => {
|
2020-01-09 06:35:04 +01:00
|
|
|
alice = await signup({ username: 'alice' });
|
|
|
|
bob = await signup({ username: 'bob' });
|
|
|
|
carol = await signup({ username: 'carol' });
|
2024-03-03 12:15:35 +01:00
|
|
|
|
|
|
|
// Mute: alice ==> carol
|
|
|
|
await api('mute/create', {
|
|
|
|
userId: carol.id,
|
|
|
|
}, alice);
|
2023-03-03 03:13:12 +01:00
|
|
|
}, 1000 * 60 * 2);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ãã¥ãŒãäœæ', async () => {
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('mute/create', {
|
|
|
|
userId: bob.id,
|
2019-04-07 14:50:36 +02:00
|
|
|
}, alice);
|
|
|
|
|
|
|
|
assert.strictEqual(res.status, 204);
|
2024-03-03 12:15:35 +01:00
|
|
|
|
|
|
|
// åäœã§ãèµ°ãããããããã«å¯äœçšæ¶ã
|
|
|
|
await api('mute/delete', {
|
|
|
|
userId: bob.id,
|
|
|
|
}, alice);
|
2022-09-17 20:27:08 +02:00
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ãèªåå®ãŠã®æçš¿ãã«ãã¥ãŒãããŠãããŠãŒã¶ãŒã®æçš¿ãå«ãŸããªã', async () => {
|
2019-04-07 14:50:36 +02:00
|
|
|
const bobNote = await post(bob, { text: '@alice hi' });
|
|
|
|
const carolNote = await post(carol, { text: '@alice hi' });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('notes/mentions', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2022-09-17 20:27:08 +02:00
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ãã¥ãŒãããŠãããŠãŒã¶ãŒããã¡ã³ã·ã§ã³ãããŠããhasUnreadMentions ã true ã«ãªããªã', async () => {
|
2019-04-07 14:50:36 +02:00
|
|
|
// ç¶æ
ãªã»ãã
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('i/read-all-unread-notes', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
await post(carol, { text: '@alice hi' });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(res.body.hasUnreadMentions, false);
|
2022-09-17 20:27:08 +02:00
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ãã¥ãŒãããŠãããŠãŒã¶ãŒããã¡ã³ã·ã§ã³ãããŠããã¹ããªãŒã ã« unreadMention ã€ãã³ããæµããŠããªã', async () => {
|
2019-04-07 14:50:36 +02:00
|
|
|
// ç¶æ
ãªã»ãã
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('i/read-all-unread-notes', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2022-06-26 12:16:32 +02:00
|
|
|
const fired = await waitFire(alice, 'main', () => post(carol, { text: '@alice hi' }), msg => msg.type === 'unreadMention');
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2022-06-26 12:16:32 +02:00
|
|
|
assert.strictEqual(fired, false);
|
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ãã¥ãŒãããŠãããŠãŒã¶ãŒããã¡ã³ã·ã§ã³ãããŠããã¹ããªãŒã ã« unreadNotification ã€ãã³ããæµããŠããªã', async () => {
|
2019-04-07 14:50:36 +02:00
|
|
|
// ç¶æ
ãªã»ãã
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('i/read-all-unread-notes', {}, alice);
|
|
|
|
await api('notifications/mark-all-as-read', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2022-06-26 12:16:32 +02:00
|
|
|
const fired = await waitFire(alice, 'main', () => post(carol, { text: '@alice hi' }), msg => msg.type === 'unreadNotification');
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2022-06-26 12:16:32 +02:00
|
|
|
assert.strictEqual(fired, false);
|
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
describe('Timeline', () => {
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ã¿ã€ã ã©ã€ã³ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒã®æçš¿ãå«ãŸããªã', async () => {
|
2023-03-08 00:56:09 +01:00
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
const bobNote = await post(bob, { text: 'hi' });
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('notes/local-timeline', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), true);
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2022-09-17 20:27:08 +02:00
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-02-02 10:18:25 +01:00
|
|
|
test('ã¿ã€ã ã©ã€ã³ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒã®æçš¿ã®Renoteãå«ãŸããªã', async () => {
|
2023-03-08 00:56:09 +01:00
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
const carolNote = await post(carol, { text: 'hi' });
|
2019-04-07 14:50:36 +02:00
|
|
|
const bobNote = await post(bob, {
|
2022-05-21 15:21:41 +02:00
|
|
|
renoteId: carolNote.id,
|
2019-04-07 14:50:36 +02:00
|
|
|
});
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('notes/local-timeline', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(note => note.id === aliceNote.id), true);
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === bobNote.id), false);
|
|
|
|
assert.strictEqual(res.body.some(note => note.id === carolNote.id), false);
|
2022-09-17 20:27:08 +02:00
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Notification', () => {
|
2023-02-02 10:18:25 +01:00
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒã®éç¥ãå«ãŸããªã(ãªã¢ã¯ã·ã§ã³)', async () => {
|
2023-03-08 00:56:09 +01:00
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
2019-04-07 14:50:36 +02:00
|
|
|
await react(bob, aliceNote, 'like');
|
|
|
|
await react(carol, aliceNote, 'like');
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2022-09-17 20:27:08 +02:00
|
|
|
});
|
2024-03-01 09:26:27 +01:00
|
|
|
|
2024-02-28 13:26:26 +01:00
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãªãã©ã€ãå«ãŸããªã', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { text: '@alice hi', replyId: aliceNote.id });
|
|
|
|
await post(carol, { text: '@alice hi', replyId: aliceNote.id });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãªãã©ã€ãå«ãŸããªã', async () => {
|
|
|
|
await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { text: '@alice hi' });
|
|
|
|
await post(carol, { text: '@alice hi' });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®åŒçšãªããŒããå«ãŸããªã', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { text: 'hi', renoteId: aliceNote.id });
|
|
|
|
await post(carol, { text: 'hi', renoteId: aliceNote.id });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãªããŒããå«ãŸããªã', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { renoteId: aliceNote.id });
|
|
|
|
await post(carol, { renoteId: aliceNote.id });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãã©ããŒéç¥ãå«ãŸããªã', async () => {
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('following/create', { userId: alice.id }, bob);
|
|
|
|
await api('following/create', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-03-03 12:15:35 +01:00
|
|
|
|
|
|
|
await api('following/delete', { userId: alice.id }, bob);
|
|
|
|
await api('following/delete', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãã©ããŒãªã¯ãšã¹ããå«ãŸããªã', async () => {
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('i/update', { isLocked: true }, alice);
|
|
|
|
await api('following/create', { userId: alice.id }, bob);
|
|
|
|
await api('following/create', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-03-03 12:15:35 +01:00
|
|
|
|
|
|
|
await api('following/delete', { userId: alice.id }, bob);
|
|
|
|
await api('following/delete', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Notification (Grouped)', () => {
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒã®éç¥ãå«ãŸããªã(ãªã¢ã¯ã·ã§ã³)', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await react(bob, aliceNote, 'like');
|
|
|
|
await react(carol, aliceNote, 'like');
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãªãã©ã€ãå«ãŸããªã', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { text: '@alice hi', replyId: aliceNote.id });
|
|
|
|
await post(carol, { text: '@alice hi', replyId: aliceNote.id });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãªãã©ã€ãå«ãŸããªã', async () => {
|
|
|
|
await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { text: '@alice hi' });
|
|
|
|
await post(carol, { text: '@alice hi' });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®åŒçšãªããŒããå«ãŸããªã', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { text: 'hi', renoteId: aliceNote.id });
|
|
|
|
await post(carol, { text: 'hi', renoteId: aliceNote.id });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãªããŒããå«ãŸããªã', async () => {
|
|
|
|
const aliceNote = await post(alice, { text: 'hi' });
|
|
|
|
await post(bob, { renoteId: aliceNote.id });
|
|
|
|
await post(carol, { renoteId: aliceNote.id });
|
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãã©ããŒéç¥ãå«ãŸããªã', async () => {
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('following/create', { userId: alice.id }, bob);
|
|
|
|
await api('following/create', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-03-03 12:15:35 +01:00
|
|
|
|
|
|
|
await api('following/delete', { userId: alice.id }, bob);
|
|
|
|
await api('following/delete', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
test('éç¥ã«ãã¥ãŒãããŠãããŠãŒã¶ãŒããã®ãã©ããŒãªã¯ãšã¹ããå«ãŸããªã', async () => {
|
2024-03-03 12:15:35 +01:00
|
|
|
await api('i/update', { isLocked: true }, alice);
|
|
|
|
await api('following/create', { userId: alice.id }, bob);
|
|
|
|
await api('following/create', { userId: alice.id }, carol);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
2024-03-03 12:15:35 +01:00
|
|
|
const res = await api('i/notifications-grouped', {}, alice);
|
2024-02-28 13:26:26 +01:00
|
|
|
|
|
|
|
assert.strictEqual(res.status, 200);
|
|
|
|
assert.strictEqual(Array.isArray(res.body), true);
|
|
|
|
|
2024-07-14 02:33:16 +02:00
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === bob.id), true);
|
|
|
|
assert.strictEqual(res.body.some(notification => 'userId' in notification && notification.userId === carol.id), false);
|
2024-02-28 13:26:26 +01:00
|
|
|
});
|
2019-04-07 14:50:36 +02:00
|
|
|
});
|
|
|
|
});
|