aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-24 17:50:05 +0200
committerlain <lain@soykaf.club>2020-06-24 17:50:05 +0200
commit143da55c56a932e4e88b4959511c59f1d73d37b9 (patch)
tree598cce65273b759d7b064fceaaab20b172d541d3 /test
parent7dfa734665bbb74058e221af0f71a88b4f37936d (diff)
parentbbb91d8ae3f1c3d5374de7610e723e63121e8222 (diff)
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into remove-twitterapi-config
Diffstat (limited to 'test')
-rw-r--r--test/unit/specs/components/user_profile.spec.js7
-rw-r--r--test/unit/specs/modules/users.spec.js14
-rw-r--r--test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js21
-rw-r--r--test/unit/specs/services/status_parser/status_parses.spec.js17
4 files changed, 22 insertions, 37 deletions
diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js
index 1b6a47d7..dcf066f9 100644
--- a/test/unit/specs/components/user_profile.spec.js
+++ b/test/unit/specs/components/user_profile.spec.js
@@ -19,6 +19,7 @@ const actions = {
const testGetters = {
findUser: state => getters.findUser(state.users),
+ relationship: state => getters.relationship(state.users),
mergedConfig: state => ({
colors: '',
highlight: {},
@@ -96,7 +97,8 @@ const externalProfileStore = new Vuex.Store({
credentials: ''
},
usersObject: { 100: extUser },
- users: [extUser]
+ users: [extUser],
+ relationships: {}
}
}
})
@@ -164,7 +166,8 @@ const localProfileStore = new Vuex.Store({
credentials: ''
},
usersObject: { 100: localUser, 'testuser': localUser },
- users: [localUser]
+ users: [localUser],
+ relationships: {}
}
}
})
diff --git a/test/unit/specs/modules/users.spec.js b/test/unit/specs/modules/users.spec.js
index eeb7afef..670acfc8 100644
--- a/test/unit/specs/modules/users.spec.js
+++ b/test/unit/specs/modules/users.spec.js
@@ -18,20 +18,6 @@ describe('The users module', () => {
expect(state.users).to.eql([user])
expect(state.users[0].name).to.eql('Dude')
})
-
- it('sets a mute bit on users', () => {
- const state = cloneDeep(defaultState)
- const user = { id: '1', name: 'Guy' }
-
- mutations.addNewUsers(state, [user])
- mutations.setMuted(state, { user, muted: true })
-
- expect(user.muted).to.eql(true)
-
- mutations.setMuted(state, { user, muted: false })
-
- expect(user.muted).to.eql(false)
- })
})
describe('findUser', () => {
diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
index cfb380ba..ccb57942 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -290,6 +290,19 @@ describe('API Entities normalizer', () => {
expect(field).to.have.property('value').that.contains('<img')
})
+ it('removes html tags from user profile fields', () => {
+ const user = makeMockUserMasto({ emojis: makeMockEmojiMasto(), fields: [{ name: 'user', value: '<a rel="me" href="https://example.com/@user">@user</a>' }] })
+
+ const parsedUser = parseUser(user)
+
+ expect(parsedUser).to.have.property('fields_text').to.be.an('array')
+
+ const field = parsedUser.fields_text[0]
+
+ expect(field).to.have.property('name').that.equal('user')
+ expect(field).to.have.property('value').that.equal('@user')
+ })
+
it('adds hide_follows and hide_followers user settings', () => {
const user = makeMockUserMasto({ pleroma: { hide_followers: true, hide_follows: false, hide_followers_count: false, hide_follows_count: true } })
@@ -338,9 +351,9 @@ describe('API Entities normalizer', () => {
describe('MastoAPI emoji adder', () => {
const emojis = makeMockEmojiMasto()
- const imageHtml = '<img src="https://example.com/image.png" alt="image" title="image" class="emoji" />'
+ const imageHtml = '<img src="https://example.com/image.png" alt=":image:" title=":image:" class="emoji" />'
.replace(/"/g, '\'')
- const thinkHtml = '<img src="https://example.com/think.png" alt="thinking" title="thinking" class="emoji" />'
+ const thinkHtml = '<img src="https://example.com/think.png" alt=":thinking:" title=":thinking:" class="emoji" />'
.replace(/"/g, '\'')
it('correctly replaces shortcodes in supplied string', () => {
@@ -366,8 +379,8 @@ describe('API Entities normalizer', () => {
shortcode: '[a-z] {|}*'
}])
const result = addEmojis('This post has :c++: emoji and :[a-z] {|}*: emoji', emojis)
- expect(result).to.include('title=\'c++\'')
- expect(result).to.include('title=\'[a-z] {|}*\'')
+ expect(result).to.include('title=\':c++:\'')
+ expect(result).to.include('title=\':[a-z] {|}*:\'')
})
})
})
diff --git a/test/unit/specs/services/status_parser/status_parses.spec.js b/test/unit/specs/services/status_parser/status_parses.spec.js
deleted file mode 100644
index 7afd5042..00000000
--- a/test/unit/specs/services/status_parser/status_parses.spec.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { removeAttachmentLinks } from '../../../../../src/services/status_parser/status_parser.js'
-
-const example = '<div class="status-content">@<a href="https://sealion.club/user/4" class="h-card mention" title="dewoo">dwmatiz</a> <a href="https://social.heldscal.la/file/3deb764ada10ce64a61b7a070b75dac45f86d2d5bf213bf18873da71d8714d86.png" title="https://social.heldscal.la/file/3deb764ada10ce64a61b7a070b75dac45f86d2d5bf213bf18873da71d8714d86.png" class="attachment" id="attachment-159853" rel="nofollow external">https://social.heldscal.la/attachment/159853</a></div>'
-
-describe('statusParser.removeAttachmentLinks', () => {
- const exampleWithoutAttachmentLinks = '<div class="status-content">@<a href="https://sealion.club/user/4" class="h-card mention" title="dewoo">dwmatiz</a> </div>'
-
- it('removes attachment links', () => {
- const parsed = removeAttachmentLinks(example)
- expect(parsed).to.eql(exampleWithoutAttachmentLinks)
- })
-
- it('works when the class is empty', () => {
- const parsed = removeAttachmentLinks('<a></a>')
- expect(parsed).to.eql('<a></a>')
- })
-})