'
+ expect(processHtml(inputOutput, processorKeep)).to.eql(inputOutput)
+ })
+
+ it('fed with sorta valid HTML but tags aren\'t closed', () => {
+ const inputOutput = 'just leaving a
hanging'
+ expect(processHtml(inputOutput, processorKeep)).to.eql(inputOutput)
+ })
+
+ it('fed with not really HTML at this point... tags that aren\'t finished', () => {
+ const inputOutput = 'do you expect me to finish this
whats going on
wha
'
+ const output = '
_
_
_
'
+ expect(processHtml(input, processorReplace)).to.eql(output)
+ })
+
+ it('fed with sorta valid HTML but tags aren\'t closed', () => {
+ const input = 'just leaving a
hanging'
+ const output = '_
_'
+ expect(processHtml(input, processorReplace)).to.eql(output)
+ })
+
+ it('fed with not really HTML at this point... tags that aren\'t finished', () => {
+ const input = 'do you expect me to finish this
{
+ const input = 'look ma
p \nwithin
p!
and a
div!
'
+ const output = '_
_\n_
_
_
_
'
+ expect(processHtml(input, processorReplace)).to.eql(output)
+ })
+
+ it('fed with maybe valid HTML? self-closing divs and ps', () => {
+ const input = 'a
what now
?'
+ const output = '_
_
_'
+ expect(processHtml(input, processorReplace)).to.eql(output)
+ })
+
+ it('fed with valid XHTML containing a CDATA', () => {
+ const input = 'Yes, it is me, '
+ const output = '_'
+ expect(processHtml(input, processorReplace)).to.eql(output)
+ })
+ })
+})
--
cgit v1.2.3-70-g09d2
From a55486f8d78161166e84b2b69709a49b3845c14e Mon Sep 17 00:00:00 2001
From: kPherox
Date: Tue, 19 Nov 2019 14:15:41 +0000
Subject: Normalize profile fields
---
src/services/entity_normalizer/entity_normalizer.service.js | 9 +++++++++
.../services/entity_normalizer/entity_normalizer.spec.js | 13 +++++++++++++
2 files changed, 22 insertions(+)
(limited to 'test')
diff --git a/src/services/entity_normalizer/entity_normalizer.service.js b/src/services/entity_normalizer/entity_normalizer.service.js
index 5f45660d..ca79df6f 100644
--- a/src/services/entity_normalizer/entity_normalizer.service.js
+++ b/src/services/entity_normalizer/entity_normalizer.service.js
@@ -46,6 +46,14 @@ export const parseUser = (data) => {
output.description = data.note
output.description_html = addEmojis(data.note, data.emojis)
+ output.fields = data.fields
+ output.fields_html = data.fields.map(field => {
+ return {
+ name: addEmojis(field.name, data.emojis),
+ value: addEmojis(field.value, data.emojis)
+ }
+ })
+
// Utilize avatar_static for gif avatars?
output.profile_image_url = data.avatar
output.profile_image_url_original = data.avatar
@@ -95,6 +103,7 @@ export const parseUser = (data) => {
if (data.source) {
output.description = data.source.note
output.default_scope = data.source.privacy
+ output.fields = data.source.fields
if (data.source.pleroma) {
output.no_rich_text = data.source.pleroma.no_rich_text
output.show_role = data.source.pleroma.show_role
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 49f378e2..cfb380ba 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -277,6 +277,19 @@ describe('API Entities normalizer', () => {
expect(parsedUser).to.have.property('description_html').that.contains('
{
+ const user = makeMockUserMasto({ emojis: makeMockEmojiMasto(), fields: [{ name: ':thinking:', value: ':image:' }] })
+
+ const parsedUser = parseUser(user)
+
+ expect(parsedUser).to.have.property('fields_html').to.be.an('array')
+
+ const field = parsedUser.fields_html[0]
+
+ expect(field).to.have.property('name').that.contains('
{
const user = makeMockUserMasto({ pleroma: { hide_followers: true, hide_follows: false, hide_followers_count: false, hide_follows_count: true } })
--
cgit v1.2.3-70-g09d2
From d37caeeded0ebe90a2e922205eed94b5cc4fcca4 Mon Sep 17 00:00:00 2001
From: taehoon
Date: Tue, 3 Dec 2019 14:40:51 -0500
Subject: add html-webpack-plugin to karma config
---
test/unit/karma.conf.js | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'test')
diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js
index 8af05c24..45d74f14 100644
--- a/test/unit/karma.conf.js
+++ b/test/unit/karma.conf.js
@@ -5,6 +5,7 @@
// var path = require('path')
var merge = require('webpack-merge')
+var HtmlWebpackPlugin = require('html-webpack-plugin')
var baseConfig = require('../../build/webpack.base.conf')
var utils = require('../../build/utils')
var webpack = require('webpack')
@@ -24,6 +25,11 @@ var webpackConfig = merge(baseConfig, {
plugins: [
new webpack.DefinePlugin({
'process.env': require('../../config/test.env')
+ }),
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ template: 'index.html',
+ inject: true
})
]
})
--
cgit v1.2.3-70-g09d2