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