Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma
Commits
aef3a3ca
Commit
aef3a3ca
authored
Apr 18, 2019
by
vaartis
Browse files
Fix tests that used finmoji
parent
52ed287e
Changes
7
Hide whitespace changes
Inline
Side-by-side
test/formatter_test.exs
View file @
aef3a3ca
...
...
@@ -245,10 +245,10 @@ test "it can parse mentions and return the relevant users" do
end
test
"it adds cool emoji"
do
text
=
"I love :
moominmamma
:"
text
=
"I love :
firefox
:"
expected_result
=
"I love <img height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
moominmamma
\"
title=
\"
moominmamma
\"
src=
\"
/
fin
moji/
128px/moominmamma-128.png
\"
/>"
"I love <img height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
firefox
\"
title=
\"
firefox
\"
src=
\"
/
e
moji/
Firefox.gif
\"
/>"
assert
Formatter
.
emojify
(
text
)
==
expected_result
end
...
...
@@ -269,10 +269,10 @@ test "it does not add XSS emoji" do
end
test
"it returns the emoji used in the text"
do
text
=
"I love :
moominmamma
:"
text
=
"I love :
firefox
:"
assert
Formatter
.
get_emoji
(
text
)
==
[
{
"
moominmamma
"
,
"/
fin
moji/
128px/moominmamma-128.png"
,
"Finmoji"
}
{
"
firefox
"
,
"/
e
moji/
Firefox.gif"
,
[
"Gif"
,
"Fun"
]
}
]
end
...
...
test/web/activity_pub/transmogrifier_test.exs
View file @
aef3a3ca
...
...
@@ -946,7 +946,7 @@ test "it strips internal hashtag data" do
test
"it strips internal fields"
do
user
=
insert
(
:user
)
{
:ok
,
activity
}
=
CommonAPI
.
post
(
user
,
%{
"status"
=>
"#2hu :
moominmamma
:"
})
{
:ok
,
activity
}
=
CommonAPI
.
post
(
user
,
%{
"status"
=>
"#2hu :
firefox
:"
})
{
:ok
,
modified
}
=
Transmogrifier
.
prepare_outgoing
(
activity
.
data
)
...
...
test/web/common_api/common_api_test.exs
View file @
aef3a3ca
...
...
@@ -40,19 +40,19 @@ test "it de-duplicates tags" do
test
"it adds emoji in the object"
do
user
=
insert
(
:user
)
{
:ok
,
activity
}
=
CommonAPI
.
post
(
user
,
%{
"status"
=>
":
moominmamma
:"
})
{
:ok
,
activity
}
=
CommonAPI
.
post
(
user
,
%{
"status"
=>
":
firefox
:"
})
assert
Object
.
normalize
(
activity
)
.
data
[
"emoji"
][
"
moominmamma
"
]
assert
Object
.
normalize
(
activity
)
.
data
[
"emoji"
][
"
firefox
"
]
end
test
"it adds emoji when updating profiles"
do
user
=
insert
(
:user
,
%{
name:
":
karjalanpiirakka
:"
})
user
=
insert
(
:user
,
%{
name:
":
firefox
:"
})
CommonAPI
.
update
(
user
)
user
=
User
.
get_cached_by_ap_id
(
user
.
ap_id
)
[
karjalanpiirakka
]
=
user
.
info
.
source_data
[
"tag"
]
[
firefox
]
=
user
.
info
.
source_data
[
"tag"
]
assert
karjalanpiirakka
[
"name"
]
==
":karjalanpiirakka
:"
assert
firefox
[
"name"
]
==
":firefox
:"
end
describe
"posting"
do
...
...
test/web/common_api/common_api_utils_test.exs
View file @
aef3a3ca
...
...
@@ -37,21 +37,21 @@ test "correct password given" do
end
test
"parses emoji from name and bio"
do
{
:ok
,
user
}
=
UserBuilder
.
insert
(%{
name:
":
karjalanpiirakka
:"
,
bio:
":
perkele
:"
})
{
:ok
,
user
}
=
UserBuilder
.
insert
(%{
name:
":
blank
:"
,
bio:
":
firefox
:"
})
expected
=
[
%{
"type"
=>
"Emoji"
,
"icon"
=>
%{
"type"
=>
"Image"
,
"url"
=>
"
#{
Endpoint
.
url
()
}
/
fin
moji/
128px/perkele-128.png
"
},
"name"
=>
":
perkele
:"
"icon"
=>
%{
"type"
=>
"Image"
,
"url"
=>
"
#{
Endpoint
.
url
()
}
/
e
moji/
Firefox.gif
"
},
"name"
=>
":
firefox
:"
},
%{
"type"
=>
"Emoji"
,
"icon"
=>
%{
"type"
=>
"Image"
,
"url"
=>
"
#{
Endpoint
.
url
()
}
/
fin
moji/
128px/karjalanpiirakka-128
.png"
"url"
=>
"
#{
Endpoint
.
url
()
}
/
e
moji/
blank
.png"
},
"name"
=>
":
karjalanpiirakka
:"
"name"
=>
":
blank
:"
}
]
...
...
test/web/push/impl_test.exs
View file @
aef3a3ca
...
...
@@ -107,7 +107,7 @@ test "renders body for create activity" do
"type"
=>
"Create"
,
"object"
=>
%{
"content"
=>
"<span>Lorem ipsum dolor sit amet</span>, consectetur :
bear
: adipiscing elit. Fusce sagittis finibus turpis."
"<span>Lorem ipsum dolor sit amet</span>, consectetur :
firefox
: adipiscing elit. Fusce sagittis finibus turpis."
}
}
}
...
...
@@ -129,7 +129,7 @@ test "renders body for announce activity" do
insert
(
:note
,
%{
data:
%{
"content"
=>
"<span>Lorem ipsum dolor sit amet</span>, consectetur :
bear
: adipiscing elit. Fusce sagittis finibus turpis."
"<span>Lorem ipsum dolor sit amet</span>, consectetur :
firefox
: adipiscing elit. Fusce sagittis finibus turpis."
}
})
...
...
test/web/twitter_api/twitter_api_test.exs
View file @
aef3a3ca
...
...
@@ -41,7 +41,7 @@ test "create a status" do
input
=
%{
"status"
=>
"Hello again, @shp.<script></script>
\n
This is on another :
moominmamma
: line. #2hu #epic #phantasmagoric"
,
"Hello again, @shp.<script></script>
\n
This is on another :
firefox
: line. #2hu #epic #phantasmagoric"
,
"media_ids"
=>
[
object
.
id
]
}
...
...
@@ -49,7 +49,7 @@ test "create a status" do
object
=
Object
.
normalize
(
activity
.
data
[
"object"
])
expected_text
=
"Hello again, <span class='h-card'><a data-user='
#{
mentioned_user
.
id
}
' class='u-url mention' href='shp'>@<span>shp</span></a></span>.<script></script><br>This is on another :
moominmamma
: line. <a class='hashtag' data-tag='2hu' href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a> <a class='hashtag' data-tag='epic' href='http://localhost:4001/tag/epic' rel='tag'>#epic</a> <a class='hashtag' data-tag='phantasmagoric' href='http://localhost:4001/tag/phantasmagoric' rel='tag'>#phantasmagoric</a><br><a href=
\"
http://example.org/image.jpg
\"
class='attachment'>image.jpg</a>"
"Hello again, <span class='h-card'><a data-user='
#{
mentioned_user
.
id
}
' class='u-url mention' href='shp'>@<span>shp</span></a></span>.<script></script><br>This is on another :
firefox
: line. <a class='hashtag' data-tag='2hu' href='http://localhost:4001/tag/2hu' rel='tag'>#2hu</a> <a class='hashtag' data-tag='epic' href='http://localhost:4001/tag/epic' rel='tag'>#epic</a> <a class='hashtag' data-tag='phantasmagoric' href='http://localhost:4001/tag/phantasmagoric' rel='tag'>#phantasmagoric</a><br><a href=
\"
http://example.org/image.jpg
\"
class='attachment'>image.jpg</a>"
assert
get_in
(
object
.
data
,
[
"content"
])
==
expected_text
assert
get_in
(
object
.
data
,
[
"type"
])
==
"Note"
...
...
@@ -65,8 +65,7 @@ test "create a status" do
assert
Enum
.
member?
(
get_in
(
activity
.
data
,
[
"to"
]),
"shp"
)
assert
activity
.
local
==
true
assert
%{
"moominmamma"
=>
"http://localhost:4001/finmoji/128px/moominmamma-128.png"
}
=
object
.
data
[
"emoji"
]
assert
%{
"firefox"
=>
"http://localhost:4001/emoji/Firefox.gif"
}
=
object
.
data
[
"emoji"
]
# hashtags
assert
object
.
data
[
"tag"
]
==
[
"2hu"
,
"epic"
,
"phantasmagoric"
]
...
...
test/web/twitter_api/views/activity_view_test.exs
View file @
aef3a3ca
...
...
@@ -91,16 +91,16 @@ test "a create activity with a html status" do
test
"a create activity with a summary containing emoji"
do
{
:ok
,
activity
}
=
CommonAPI
.
post
(
insert
(
:user
),
%{
"spoiler_text"
=>
":
woollysocks
: meow"
,
"spoiler_text"
=>
":
firefox
: meow"
,
"status"
=>
"."
})
result
=
ActivityView
.
render
(
"activity.json"
,
activity:
activity
)
expected
=
":
woollysocks
: meow"
expected
=
":
firefox
: meow"
expected_html
=
"<img height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
woollysocks
\"
title=
\"
woollysocks
\"
src=
\"
http://localhost:4001/
fin
moji/
128px/woollysocks-128.png
\"
/> meow"
"<img height=
\"
32px
\"
width=
\"
32px
\"
alt=
\"
firefox
\"
title=
\"
firefox
\"
src=
\"
http://localhost:4001/
e
moji/
Firefox.gif
\"
/> meow"
assert
result
[
"summary"
]
==
expected
assert
result
[
"summary_html"
]
==
expected_html
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment