aboutsummaryrefslogtreecommitdiff
path: root/test/unit/specs/modules
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2020-08-27 14:45:03 +0000
committerShpuld Shpludson <shp@cock.li>2020-08-27 14:45:03 +0000
commite768ec1fca2f7580d111b0878a9695b0c8b9dbb1 (patch)
tree668ebbcd6818b3c7ad70a372c9f77fa9cffb6a3f /test/unit/specs/modules
parent5d49edc823ba2ea3e34d4fd6c5efcc84ef9712f7 (diff)
parentd09f43ba7a179cdca9a2d808631f8ba213dd7710 (diff)
Merge branch '2.1.0-rc0' into 'master'
2.1.0 into master See merge request pleroma/pleroma-fe!1217
Diffstat (limited to 'test/unit/specs/modules')
-rw-r--r--test/unit/specs/modules/statuses.spec.js8
-rw-r--r--test/unit/specs/modules/users.spec.js36
2 files changed, 41 insertions, 3 deletions
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js
index fe42e85b..b790b231 100644
--- a/test/unit/specs/modules/statuses.spec.js
+++ b/test/unit/specs/modules/statuses.spec.js
@@ -330,7 +330,7 @@ describe('Statuses module', () => {
const deletion = makeMockStatus({ id: '4', type: 'deletion' })
deletion.text = 'Dolus deleted notice {{tag:gs.smuglo.li,2016-11-18:noticeId=1038007:objectType=note}}.'
deletion.uri = 'xxx'
-
+ const newNotificationSideEffects = () => {}
mutations.addNewStatuses(state, { statuses: [status, otherStatus], user })
mutations.addNewNotifications(
state,
@@ -342,7 +342,8 @@ describe('Statuses module', () => {
status: otherStatus,
action: otherStatus,
seen: false
- }]
+ }],
+ newNotificationSideEffects
})
expect(state.notifications.data.length).to.eql(1)
@@ -356,7 +357,8 @@ describe('Statuses module', () => {
status: mentionedStatus,
action: mentionedStatus,
seen: false
- }]
+ }],
+ newNotificationSideEffects
})
mutations.addNewStatuses(state, { statuses: [mentionedStatus], user })
diff --git a/test/unit/specs/modules/users.spec.js b/test/unit/specs/modules/users.spec.js
index 670acfc8..dfa5684d 100644
--- a/test/unit/specs/modules/users.spec.js
+++ b/test/unit/specs/modules/users.spec.js
@@ -18,6 +18,42 @@ describe('The users module', () => {
expect(state.users).to.eql([user])
expect(state.users[0].name).to.eql('Dude')
})
+
+ it('merging array field in new information for old users', () => {
+ const state = cloneDeep(defaultState)
+ const user = {
+ id: '1',
+ fields: [
+ { name: 'Label 1', value: 'Content 1' }
+ ]
+ }
+ const firstModUser = {
+ id: '1',
+ fields: [
+ { name: 'Label 2', value: 'Content 2' },
+ { name: 'Label 3', value: 'Content 3' }
+ ]
+ }
+ const secondModUser = {
+ id: '1',
+ fields: [
+ { name: 'Label 4', value: 'Content 4' }
+ ]
+ }
+
+ mutations.addNewUsers(state, [user])
+ expect(state.users[0].fields).to.have.length(1)
+ expect(state.users[0].fields[0].name).to.eql('Label 1')
+
+ mutations.addNewUsers(state, [firstModUser])
+ expect(state.users[0].fields).to.have.length(2)
+ expect(state.users[0].fields[0].name).to.eql('Label 2')
+ expect(state.users[0].fields[1].name).to.eql('Label 3')
+
+ mutations.addNewUsers(state, [secondModUser])
+ expect(state.users[0].fields).to.have.length(1)
+ expect(state.users[0].fields[0].name).to.eql('Label 4')
+ })
})
describe('findUser', () => {