aboutsummaryrefslogtreecommitdiff
path: root/test/unit/specs
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/specs')
-rw-r--r--test/unit/specs/boot/routes.spec.js3
-rw-r--r--test/unit/specs/components/emoji_input.spec.js2
-rw-r--r--test/unit/specs/components/rich_content.spec.js28
-rw-r--r--test/unit/specs/components/user_profile.spec.js6
-rw-r--r--test/unit/specs/modules/statuses.spec.js4
-rw-r--r--test/unit/specs/services/chat_service/chat_service.spec.js24
-rw-r--r--test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js8
-rw-r--r--test/unit/specs/services/file_size_format/file_size_format.spec.js4
-rw-r--r--test/unit/specs/services/theme_data/sanity_checks.spec.js2
9 files changed, 40 insertions, 41 deletions
diff --git a/test/unit/specs/boot/routes.spec.js b/test/unit/specs/boot/routes.spec.js
index 439aefd4..5cffefbb 100644
--- a/test/unit/specs/boot/routes.spec.js
+++ b/test/unit/specs/boot/routes.spec.js
@@ -19,6 +19,7 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
+ // eslint-disable-next-line no-prototype-builtins
expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true)
})
@@ -27,6 +28,7 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
+ // eslint-disable-next-line no-prototype-builtins
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
})
@@ -35,6 +37,7 @@ describe('routes', () => {
const matchedComponents = router.currentRoute.value.matched
+ // eslint-disable-next-line no-prototype-builtins
expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true)
})
})
diff --git a/test/unit/specs/components/emoji_input.spec.js b/test/unit/specs/components/emoji_input.spec.js
index 6188308e..752111ef 100644
--- a/test/unit/specs/components/emoji_input.spec.js
+++ b/test/unit/specs/components/emoji_input.spec.js
@@ -29,7 +29,7 @@ const generateInput = (value, padEmoji = true) => {
modelValue: value
},
slots: {
- 'default': () => h('input', '')
+ default: () => h('input', '')
}
})
return wrapper
diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js
index 958fb997..616df6a0 100644
--- a/test/unit/specs/components/rich_content.spec.js
+++ b/test/unit/specs/components/rich_content.spec.js
@@ -4,7 +4,15 @@ import RichContent from 'src/components/rich_content/rich_content.jsx'
const attentions = []
const global = {
mocks: {
- '$store': null
+ $store: {
+ state: {},
+ getters: {
+ mergedConfig: () => ({
+ mentionLinkShowTooltip: true
+ }),
+ findUserByUrl: () => null
+ }
+ }
},
stubs: {
FAIcon: true
@@ -131,8 +139,7 @@ describe('RichContent', () => {
].join(''),
[
makeMention('John'),
- makeMention('Josh'),
- makeMention('Jeremy')
+ makeMention('Josh'), makeMention('Jeremy')
].join('')
].join('\n')
@@ -349,7 +356,6 @@ describe('RichContent', () => {
p(
'<span class="MentionsLine">',
'<span class="MentionLink mention-link">',
- '<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">',
'<span>',
'https://</span>',
@@ -358,10 +364,7 @@ describe('RichContent', () => {
'<span>',
'</span>',
'</a>',
- '<!-- eslint-enable vue/no-v-html -->',
- '<!--v-if-->', // v-if placeholder, mentionlink's "new" (i.e. rich) display
'</span>',
- '<!--v-if-->', // v-if placeholder, mentionsline's extra mentions and stuff
'</span>'
),
p(
@@ -380,7 +383,7 @@ describe('RichContent', () => {
}
})
- expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
+ expect(wrapper.html().replace(/\n/g, '').replace(/<!--.*?-->/g, '')).to.eql(compwrap(expected))
})
it('rich contents of nested mentions are handled properly', () => {
@@ -412,7 +415,6 @@ describe('RichContent', () => {
'<span class="poast-style">',
'<span class="MentionsLine">',
'<span class="MentionLink mention-link">',
- '<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">',
'<span>',
'https://</span>',
@@ -421,11 +423,8 @@ describe('RichContent', () => {
'<span>',
'</span>',
'</a>',
- '<!-- eslint-enable vue/no-v-html -->',
- '<!--v-if-->', // v-if placeholder, mentionlink's "new" (i.e. rich) display
'</span>',
'<span class="MentionLink mention-link">',
- '<!-- eslint-disable vue/no-v-html -->',
'<a href="lol" class="original" target="_blank">',
'<span>',
'https://</span>',
@@ -434,10 +433,7 @@ describe('RichContent', () => {
'<span>',
'</span>',
'</a>',
- '<!-- eslint-enable vue/no-v-html -->',
- '<!--v-if-->', // v-if placeholder, mentionlink's "new" (i.e. rich) display
'</span>',
- '<!--v-if-->', // v-if placeholder, mentionsline's extra mentions and stuff
'</span>',
' ',
'</span>',
@@ -455,7 +451,7 @@ describe('RichContent', () => {
}
})
- expect(wrapper.html().replace(/\n/g, '')).to.eql(compwrap(expected))
+ expect(wrapper.html().replace(/\n/g, '').replace(/<!--.*?-->/g, '')).to.eql(compwrap(expected))
})
it('rich contents of a link are handled properly', () => {
diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js
index 584758f7..0fbab722 100644
--- a/test/unit/specs/components/user_profile.spec.js
+++ b/test/unit/specs/components/user_profile.spec.js
@@ -163,7 +163,7 @@ const localProfileStore = createStore({
currentUser: {
credentials: ''
},
- usersObject: { 100: localUser, 'testuser': localUser },
+ usersObject: { 100: localUser, testuser: localUser },
users: [localUser],
relationships: {}
}
@@ -175,7 +175,7 @@ describe.skip('UserProfile', () => {
it('renders external profile', () => {
const wrapper = mount(UserProfile, {
global: {
- plugins: [ externalProfileStore ],
+ plugins: [externalProfileStore],
mocks: {
$route: {
params: { id: 100 },
@@ -192,7 +192,7 @@ describe.skip('UserProfile', () => {
it('renders local profile', () => {
const wrapper = mount(UserProfile, {
global: {
- plugins: [ localProfileStore ],
+ plugins: [localProfileStore],
mocks: {
$route: {
params: { name: 'testUser' },
diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js
index b790b231..a8d0e5a3 100644
--- a/test/unit/specs/modules/statuses.spec.js
+++ b/test/unit/specs/modules/statuses.spec.js
@@ -245,7 +245,7 @@ describe('Statuses module', () => {
it('increments count in existing reaction', () => {
const state = defaultState()
const status = makeMockStatus({ id: '1' })
- status.emoji_reactions = [ { name: '😂', count: 1, accounts: [] } ]
+ status.emoji_reactions = [{ name: '😂', count: 1, accounts: [] }]
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
mutations.addOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } })
@@ -269,7 +269,7 @@ describe('Statuses module', () => {
it('decreases count in existing reaction', () => {
const state = defaultState()
const status = makeMockStatus({ id: '1' })
- status.emoji_reactions = [ { name: '😂', count: 2, accounts: [{ id: 'me' }] } ]
+ status.emoji_reactions = [{ name: '😂', count: 2, accounts: [{ id: 'me' }] }]
mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' })
mutations.removeOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } })
diff --git a/test/unit/specs/services/chat_service/chat_service.spec.js b/test/unit/specs/services/chat_service/chat_service.spec.js
index fbbca436..a42269b4 100644
--- a/test/unit/specs/services/chat_service/chat_service.spec.js
+++ b/test/unit/specs/services/chat_service/chat_service.spec.js
@@ -24,23 +24,23 @@ describe('chatService', () => {
describe('.add', () => {
it("Doesn't add duplicates", () => {
const chat = chatService.empty()
- chatService.add(chat, { messages: [ message1 ] })
- chatService.add(chat, { messages: [ message1 ] })
+ chatService.add(chat, { messages: [message1] })
+ chatService.add(chat, { messages: [message1] })
expect(chat.messages.length).to.eql(1)
- chatService.add(chat, { messages: [ message2 ] })
+ chatService.add(chat, { messages: [message2] })
expect(chat.messages.length).to.eql(2)
})
it('Updates minId and lastMessage and newMessageCount', () => {
const chat = chatService.empty()
- chatService.add(chat, { messages: [ message1 ] })
+ chatService.add(chat, { messages: [message1] })
expect(chat.maxId).to.eql(message1.id)
expect(chat.minId).to.eql(message1.id)
expect(chat.newMessageCount).to.eql(1)
- chatService.add(chat, { messages: [ message2 ] })
+ chatService.add(chat, { messages: [message2] })
expect(chat.maxId).to.eql(message2.id)
expect(chat.minId).to.eql(message1.id)
expect(chat.newMessageCount).to.eql(2)
@@ -50,7 +50,7 @@ describe('chatService', () => {
expect(chat.lastSeenMessageId).to.eql(message2.id)
// Add message with higher id
- chatService.add(chat, { messages: [ message3 ] })
+ chatService.add(chat, { messages: [message3] })
expect(chat.newMessageCount).to.eql(1)
})
})
@@ -59,9 +59,9 @@ describe('chatService', () => {
it('Updates minId and lastMessage', () => {
const chat = chatService.empty()
- chatService.add(chat, { messages: [ message1 ] })
- chatService.add(chat, { messages: [ message2 ] })
- chatService.add(chat, { messages: [ message3 ] })
+ chatService.add(chat, { messages: [message1] })
+ chatService.add(chat, { messages: [message2] })
+ chatService.add(chat, { messages: [message3] })
expect(chat.maxId).to.eql(message3.id)
expect(chat.minId).to.eql(message1.id)
@@ -80,9 +80,9 @@ describe('chatService', () => {
it('Inserts date separators', () => {
const chat = chatService.empty()
- chatService.add(chat, { messages: [ message1 ] })
- chatService.add(chat, { messages: [ message2 ] })
- chatService.add(chat, { messages: [ message3 ] })
+ chatService.add(chat, { messages: [message1] })
+ chatService.add(chat, { messages: [message2] })
+ chatService.add(chat, { messages: [message3] })
const view = chatService.getView(chat)
expect(view.map(i => i.type)).to.eql(['date', 'message', 'message', 'date', 'message'])
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 03fb32c9..525e57a5 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -314,8 +314,8 @@ describe('API Entities normalizer', () => {
const linkHeader = '<https://example.com/api/v1/notifications?max_id=861676>; rel="next", <https://example.com/api/v1/notifications?min_id=861741>; rel="prev"'
const result = parseLinkHeaderPagination(linkHeader)
expect(result).to.eql({
- 'maxId': 861676,
- 'minId': 861741
+ maxId: 861676,
+ minId: 861741
})
})
@@ -323,8 +323,8 @@ describe('API Entities normalizer', () => {
const linkHeader = '<http://example.com/api/v1/timelines/home?max_id=9waQx5IIS48qVue2Ai>; rel="next", <http://example.com/api/v1/timelines/home?min_id=9wi61nIPnfn674xgie>; rel="prev"'
const result = parseLinkHeaderPagination(linkHeader, { flakeId: true })
expect(result).to.eql({
- 'maxId': '9waQx5IIS48qVue2Ai',
- 'minId': '9wi61nIPnfn674xgie'
+ maxId: '9waQx5IIS48qVue2Ai',
+ minId: '9wi61nIPnfn674xgie'
})
})
})
diff --git a/test/unit/specs/services/file_size_format/file_size_format.spec.js b/test/unit/specs/services/file_size_format/file_size_format.spec.js
index e02ac379..6804b6eb 100644
--- a/test/unit/specs/services/file_size_format/file_size_format.spec.js
+++ b/test/unit/specs/services/file_size_format/file_size_format.spec.js
@@ -25,8 +25,8 @@ describe('fileSizeFormat', () => {
}
]
- var res = []
- for (var value in values) {
+ const res = []
+ for (const value in values) {
res.push(fileSizeFormatService.fileSizeFormat(values[value]))
}
expect(res).to.eql(expected)
diff --git a/test/unit/specs/services/theme_data/sanity_checks.spec.js b/test/unit/specs/services/theme_data/sanity_checks.spec.js
index f0072e7d..f94c6a08 100644
--- a/test/unit/specs/services/theme_data/sanity_checks.spec.js
+++ b/test/unit/specs/services/theme_data/sanity_checks.spec.js
@@ -6,7 +6,7 @@ const checkColors = (output) => {
expect(v, key).to.be.an('object')
expect(v, key).to.include.all.keys('r', 'g', 'b')
'rgba'.split('').forEach(k => {
- if ((k === 'a' && v.hasOwnProperty('a')) || k !== 'a') {
+ if ((k === 'a' && Object.prototype.hasOwnProperty.call(v, 'a')) || k !== 'a') {
expect(v[k], key + '.' + k).to.be.a('number')
expect(v[k], key + '.' + k).to.be.least(0)
expect(v[k], key + '.' + k).to.be.most(k === 'a' ? 1 : 255)