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