aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlambadalambda <gitgud@rogerbraun.net>2017-09-04 02:51:06 -0400
committerlambadalambda <gitgud@rogerbraun.net>2017-09-04 02:51:06 -0400
commit9c7eb1de3c58b3ddc78548f814f7130d7d9aa99c (patch)
treea1a28b7319a196ba9e2d2e736692b603233ace3c
parent00f8857876170444dcb32c395e9a16f0a9465b95 (diff)
parent04a3a4419574127c131079db19ca3d283032d215 (diff)
Merge branch 'feature/follow-notif-tests' into 'develop'
Add tests for follow notifications. See merge request !115
-rw-r--r--test/unit/specs/modules/statuses.spec.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js
index d25cc108..372d1aaa 100644
--- a/test/unit/specs/modules/statuses.spec.js
+++ b/test/unit/specs/modules/statuses.spec.js
@@ -386,5 +386,41 @@ describe('The Statuses module', () => {
expect(state.notifications).to.have.length(1)
})
+
+ it('adds a notification when the user is followed', () => {
+ const state = cloneDeep(defaultState)
+ const user = {id: 1, screen_name: 'b'}
+ const follower = {id: 2, screen_name: 'a'}
+
+ const follow = {
+ id: 3,
+ is_post_verb: false,
+ activity_type: 'follow',
+ text: 'a started following b',
+ user: follower
+ }
+
+ mutations.addNewStatuses(state, { statuses: [follow], showImmediately: true, timeline: 'public', user })
+
+ expect(state.notifications).to.have.length(1)
+ })
+
+ it('does not add a notification when an other user is followed', () => {
+ const state = cloneDeep(defaultState)
+ const user = {id: 1, screen_name: 'b'}
+ const follower = {id: 2, screen_name: 'a'}
+
+ const follow = {
+ id: 3,
+ is_post_verb: false,
+ activity_type: 'follow',
+ text: 'a started following b@shitposter.club',
+ user: follower
+ }
+
+ mutations.addNewStatuses(state, { statuses: [follow], showImmediately: true, timeline: 'public', user })
+
+ expect(state.notifications).to.have.length(0)
+ })
})
})