2018-08-28 14:45:15 +01:00
|
|
|
import { loginAsFoobar } from '../roles'
|
|
|
|
import {
|
|
|
|
getFavoritesCount,
|
|
|
|
getNthStatus, getNthStatusContent, getReblogsCount, homeNavButton
|
|
|
|
} from '../utils'
|
|
|
|
import { favoriteStatusAs, postAs, reblogStatusAs } from '../serverActions'
|
|
|
|
|
|
|
|
fixture`119-status-counts-update.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Fav stats update', async t => {
|
2019-08-03 21:49:37 +01:00
|
|
|
const status = await postAs('foobar', 'hey hello look at this toot')
|
|
|
|
const statusId = status.id
|
2018-08-28 14:45:15 +01:00
|
|
|
await favoriteStatusAs('admin', statusId)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatusContent(1).innerText).contains('hey hello look at this toot')
|
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getFavoritesCount()).eql(1)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('quux', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getFavoritesCount()).eql(2)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('baz', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getFavoritesCount()).eql(3)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('LockedAccount', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getFavoritesCount()).eql(4)
|
|
|
|
})
|
|
|
|
|
2019-11-18 02:23:32 +00:00
|
|
|
test('Boost stats update', async t => {
|
2019-08-03 21:49:37 +01:00
|
|
|
const status = await postAs('foobar', 'oh why hello it looks like another toot')
|
|
|
|
const statusId = status.id
|
2018-08-28 14:45:15 +01:00
|
|
|
await reblogStatusAs('admin', statusId)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatusContent(1).innerText).contains('oh why hello it looks like another toot')
|
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await reblogStatusAs('quux', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(2)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await reblogStatusAs('baz', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(3)
|
|
|
|
.click(homeNavButton)
|
2019-05-05 23:02:14 +01:00
|
|
|
await reblogStatusAs('ExternalLinks', statusId)
|
2018-08-28 14:45:15 +01:00
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(4)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Fav and reblog stats update for a boosted toot', async t => {
|
2019-08-03 21:49:37 +01:00
|
|
|
const status = await postAs('ExternalLinks', 'this will get boosted')
|
|
|
|
const statusId = status.id
|
2018-08-28 14:45:15 +01:00
|
|
|
await reblogStatusAs('admin', statusId)
|
|
|
|
await favoriteStatusAs('admin', statusId)
|
|
|
|
await favoriteStatusAs('quux', statusId)
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.expect(getNthStatusContent(1).innerText).contains('this will get boosted')
|
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.expect(getFavoritesCount()).eql(2)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('baz', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.expect(getFavoritesCount()).eql(3)
|
|
|
|
.click(homeNavButton)
|
|
|
|
await favoriteStatusAs('LockedAccount', statusId)
|
|
|
|
await t
|
2019-02-28 16:56:25 +00:00
|
|
|
.click(getNthStatus(1))
|
2018-08-28 14:45:15 +01:00
|
|
|
.expect(getReblogsCount()).eql(1)
|
|
|
|
.expect(getFavoritesCount()).eql(4)
|
|
|
|
})
|