aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2016-11-18 22:25:42 +0100
committerRoger Braun <roger@rogerbraun.net>2016-11-18 22:25:42 +0100
commit4cef86f2a864ac643cf5efc43824d650beea8307 (patch)
treeb51be5332f39f36f5193aa6f5a413fe0d287678f /test
parent11dd084835a463f95e770ecbc8b6318ba9399498 (diff)
Add status deletion.
Kind of wonky. Would be better if we used the AS endpoints.
Diffstat (limited to 'test')
-rw-r--r--test/unit/specs/modules/statuses.spec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js
index 80bb5fc6..d6e1dc20 100644
--- a/test/unit/specs/modules/statuses.spec.js
+++ b/test/unit/specs/modules/statuses.spec.js
@@ -78,6 +78,22 @@ describe('The Statuses module', () => {
expect(state.timelines.public.newStatusCount).to.equal(0)
})
+ it('removes statuses by tag on deletion', () => {
+ const state = cloneDeep(defaultState)
+ const status = makeMockStatus({id: 1})
+ status.tag = 'xxx'
+ const deletion = makeMockStatus({id: 2, is_post_verb: false})
+ deletion.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.'
+ deletion.uri = 'xxx'
+
+ mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
+ mutations.addNewStatuses(state, { statuses: [deletion], showImmediately: true, timeline: 'public' })
+
+ expect(state.allStatuses).to.eql([])
+ expect(state.timelines.public.statuses).to.eql([])
+ expect(state.timelines.public.visibleStatuses).to.eql([])
+ })
+
it('keeps a descending by id order in timeline.visibleStatuses and timeline.statuses', () => {
const state = cloneDeep(defaultState)
const status = makeMockStatus({id: 2})
@@ -152,6 +168,8 @@ describe('The Statuses module', () => {
// Add new version of status
mutations.addNewStatuses(state, { statuses: [retweet], showImmediately: false, timeline: 'public' })
expect(state.timelines.public.visibleStatuses).to.have.length(1)
+ // Don't add the retweet itself if the tweet is visible
+ expect(state.timelines.public.statuses).to.have.length(1)
expect(state.allStatuses).to.have.length(2)
expect(state.allStatuses[0].text).to.eql(modStatus.text)
})