From a0305e90f06151c237340207fe40f2e923379825 Mon Sep 17 00:00:00 2001 From: floatingghost Date: Wed, 15 Jun 2022 17:22:02 +0000 Subject: [PATCH] fix tests and add CI (#5) Co-authored-by: FloatingGhost Reviewed-on: http://akkoma.dev/AkkomaGang/pleroma-fe/pulls/5 --- .woodpecker.yml | 48 +++++++++++++++++++ src/components/rich_content/rich_content.jsx | 20 -------- .../specs/components/rich_content.spec.js | 4 +- 3 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 .woodpecker.yml diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 00000000..c882fea9 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,48 @@ +pipeline: + lint: + when: + event: + - push + image: node:16 + commands: + - yarn + - yarn lint + - yarn stylelint + + test: + when: + event: + - push + image: node:16 + commands: + - apt update + - apt install firefox-esr -y --no-install-recommends + - yarn + - yarn unit + + build: + when: + event: + - tag + image: node:16 + commands: + - yarn + - yarn build + + release: + when: + event: + - tag + image: node:16 + secrets: + - SCW_ACCESS_KEY + - SCW_SECRET_KEY + - SCW_DEFAULT_ORGANIZATION_ID + commands: + - apt-get update && apt-get install -y rclone wget zip + - wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64 + - mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli + - chmod +x scaleway-cli + - ./scaleway-cli object config install type=rclone + - zip akkoma-fe.zip -r dist + - rclone copyto akkoma-fe.zip scaleway:akkoma-updates/frontend/akkoma-fe.zip diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index 4a31dbc5..ca075270 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -112,23 +112,6 @@ export default { } } - const renderLink = (attrs, children) => { - const updatedLink = attrs['href'].replace(/&/g, '&') - const updatedChildren = children.map(child => { - if (typeof child === 'string') { - return child.replace(attrs['href'], updatedLink) - } - if (child[0] === '') { - return - { child[1] } - - } - return child[1] - }) - return - { ...updatedChildren } - - } // Processor to use with html_tree_converter const processItem = (item, index, array, what) => { // Handle text nodes - just add emoji @@ -193,9 +176,6 @@ export default { return renderMention(attrs, children) } else { currentMentions = null - if (attrs['href']) { - return renderLink(attrs, children) - } break } case 'span': diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index a1299e6f..ea26ee43 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -44,12 +44,12 @@ describe('RichContent', () => { const html = [ p('Testing 'em all'), 'Testing 'em all', - 'http://example.com?a=1&b=2' + 'http://example.com?a=1' ].join('') const expected = [ p('Testing \'em all'), 'Testing \'em all', - 'http://example.com?a=1&b=2' + 'http://example.com?a=1' ].join('') const wrapper = shallowMount(RichContent, { global,