From a0eaac2216e7f279e10c6b688b9fa81f7a4fad2d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 22 Jun 2021 21:09:29 +0300 Subject: [PATCH] fix tests --- .../specs/components/rich_content.spec.js | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index fbf8973d..9ac9bedb 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -2,8 +2,12 @@ import { mount, shallowMount, createLocalVue } from '@vue/test-utils' import RichContent from 'src/components/rich_content/rich_content.jsx' const localVue = createLocalVue() +const attentions = [] -const makeMention = (who) => `@${who}` +const makeMention = (who) => { + attentions.push({ statusnet_profile_url: `https://fake.tld/@${who}` }) + return `@${who}` +} const stubMention = (who) => `` const lastMentions = (...data) => `${data.join('')}` const p = (...data) => `

${data.join('')}

` @@ -16,6 +20,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -39,6 +44,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -62,6 +68,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -89,6 +96,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -120,6 +128,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -157,6 +166,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -186,6 +196,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -215,6 +226,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -257,6 +269,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -292,6 +305,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -334,6 +348,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -362,6 +377,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: true, @@ -386,6 +402,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: true, @@ -406,6 +423,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -427,6 +445,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -444,6 +463,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: false, greentext: false, @@ -472,6 +492,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, handleLinks: true, greentext: true, emoji: [], @@ -507,6 +528,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -537,6 +559,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -580,6 +603,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -616,6 +640,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -652,6 +677,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: true, handleLinks: true, greentext: true, @@ -699,6 +725,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -711,6 +738,7 @@ describe('RichContent', () => { }) it('rich contents of a mention in beginning are handled properly', () => { + attentions.push({ statusnet_profile_url: 'lol' }) const html = [ p( '', @@ -752,6 +780,7 @@ describe('RichContent', () => { MentionLink: true }, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true, @@ -796,6 +825,7 @@ describe('RichContent', () => { const wrapper = shallowMount(RichContent, { localVue, propsData: { + attentions, hideMentions: false, handleLinks: true, greentext: true,