Skip to content

Commit

Permalink
test(e2e/streaming): フォローしていないユーザによるフォロワー限定投稿に対するリプライがソーシャルタイムラインで表示さ…
Browse files Browse the repository at this point in the history
…れることがある問題
  • Loading branch information
anatawa12 committed May 24, 2024
1 parent 2cbdda4 commit b619c3e
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions packages/backend/test/e2e/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ describe('Streaming', () => {
await api('following/create', { userId: chitose.id }, kyoko);

// Follow: erin <=> ayano each other.
// erin => ayano: withReplies: false
await api('following/create', { userId: ayano.id, withReplies: false }, erin);
// ayano => erin: withReplies: true
await api('following/create', { userId: erin.id, withReplies: true }, ayano);
// erin => ayano: withReplies: true
await api('following/create', { userId: ayano.id, withReplies: true }, erin);
// ayano => erin: withReplies: false
await api('following/create', { userId: erin.id, withReplies: false }, ayano);

// Mute: chitose => kanako
await api('mute/create', { userId: kanako.id }, chitose);
Expand Down Expand Up @@ -307,22 +307,22 @@ describe('Streaming', () => {
});

test('withReplies: true のとき自分のfollowers投稿に対するリプライが流れる', async () => {
const ayanoNote = await post(ayano, { text: 'hi', visibility: 'followers' });
const erinNote = await post(erin, { text: 'hi', visibility: 'followers' });
const fired = await waitFire(
ayano, 'homeTimeline', // ayano:home
() => api('notes/create', { text: 'hello', replyId: ayanoNote.id }, erin), // erin reply to ayano's followers post
msg => msg.type === 'note' && msg.body.userId === erin.id, // wait erin
erin, 'homeTimeline', // erin:home
() => api('notes/create', { text: 'hello', replyId: erinNote.id }, ayano), // ayano reply to erin's followers post
msg => msg.type === 'note' && msg.body.userId === ayano.id, // wait ayano
);

assert.strictEqual(fired, true);
});

test('withReplies: false でも自分の投稿に対するリプライが流れる', async () => {
const erinNote = await post(erin, { text: 'hi', visibility: 'followers' });
const ayanoNote = await post(ayano, { text: 'hi', visibility: 'followers' });
const fired = await waitFire(
erin, 'homeTimeline', // erin:home
() => api('notes/create', { text: 'hello', replyId: erinNote.id }, ayano), // ayano reply to erin's followers post
msg => msg.type === 'note' && msg.body.userId === ayano.id, // wait ayano
ayano, 'homeTimeline', // ayano:home
() => api('notes/create', { text: 'hello', replyId: ayanoNote.id }, erin), // erin reply to ayano's followers post
msg => msg.type === 'note' && msg.body.userId === erin.id, // wait erin
);

assert.strictEqual(fired, true);
Expand Down Expand Up @@ -507,6 +507,17 @@ describe('Streaming', () => {
});

test('withReplies: true のとき自分のfollowers投稿に対するリプライが流れる', async () => {
const erinNote = await post(erin, { text: 'hi', visibility: 'followers' });
const fired = await waitFire(
erin, 'homeTimeline', // erin:home
() => api('notes/create', { text: 'hello', replyId: erinNote.id }, ayano), // ayano reply to erin's followers post
msg => msg.type === 'note' && msg.body.userId === ayano.id, // wait ayano
);

assert.strictEqual(fired, true);
});

test('withReplies: false でも自分の投稿に対するリプライが流れる', async () => {
const ayanoNote = await post(ayano, { text: 'hi', visibility: 'followers' });
const fired = await waitFire(
ayano, 'homeTimeline', // ayano:home
Expand All @@ -517,15 +528,14 @@ describe('Streaming', () => {
assert.strictEqual(fired, true);
});

test('withReplies: false でも自分の投稿に対するリプライが流れる', async () => {
const erinNote = await post(erin, { text: 'hi', visibility: 'followers' });
test('withReplies: true のフォローしていない人のfollowersノートに対するリプライが流れない', async () => {
const fired = await waitFire(
erin, 'homeTimeline', // erin:home
() => api('notes/create', { text: 'hello', replyId: erinNote.id }, ayano), // ayano reply to erin's followers post
() => api('notes/create', { text: 'hello', replyId: chitose.id }, ayano), // ayano reply to chitose's post
msg => msg.type === 'note' && msg.body.userId === ayano.id, // wait ayano
);

assert.strictEqual(fired, true);
assert.strictEqual(fired, false);
});
});

Expand Down

0 comments on commit b619c3e

Please sign in to comment.