test: add another threading test (#1773)

This commit is contained in:
Nolan Lawson 2020-05-15 07:47:42 -07:00 committed by GitHub
parent 3f7aa7fb00
commit 9e09ba6ca1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 0 deletions

View File

@ -226,3 +226,35 @@ test('complex thread is in correct order - with mixed self-replies', async t =>
await validateTimeline(t, order.map(content => ({ content })))
})
test('complex thread is in correct order - with mixed self-replies 2', async t => {
const { id: a } = await postAs('foobar', 'a')
const { id: b } = await postReplyAs('baz', 'b', a)
const { id: c } = await postReplyAs('baz', 'c', b)
const { id: a1 } = await postReplyAs('baz', 'a1', a)
const { id: d } = await postReplyAs('baz', 'd', c)
const { id: a2 } = await postReplyAs('baz', 'a2', a1)
const { id: b1 } = await postReplyAs('baz', 'b1', b)
const { id: a3 } = await postReplyAs('baz', 'a3', a2)
await postReplyAs('baz', 'e', d)
await postReplyAs('baz', 'b2', b1)
await postReplyAs('baz', 'a4', a3)
await postReplyAs('baz', 'a1a', a1)
// reply chain: foobar -> foobar -> baz -> foobar -> foobar
// when foobar replies to itself after replying to baz, is it promoted?
// see https://github.com/tootsuite/mastodon/pull/9320#issuecomment-440705662
const { id: mixed1 } = await postReplyAs('foobar', 'foobar-mixed1', a)
const { id: mixed2 } = await postReplyAs('baz', 'baz-mixed2', mixed1)
const { id: mixed3 } = await postReplyAs('foobar', 'foobar-mixed3', mixed2)
await postReplyAs('foobar', 'foobar-mixed4', mixed3)
await postReplyAs('foobar', 'foobar-mixed1a', a)
await postReplyAs('foobar', 'foobar-mixed1b', a)
await postReplyAs('foobar', 'foobar-mixed2a', mixed1)
await loginAsFoobar(t)
await scrollToStatus(t, 7)
await t.click(getNthStatus(7))
const order = ('a foobar-mixed1 foobar-mixed2a foobar-mixed1a foobar-mixed1b ' +
'b c d e b1 b2 a1 a2 a3 a4 a1a baz-mixed2 foobar-mixed3 foobar-mixed4').split(' ')
await validateTimeline(t, order.map(content => ({ content })))
})