Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33102637
loader_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
loader_test.exs
View Options
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule
Pleroma.Emoji.LoaderTest
do
use
ExUnit.Case
,
async
:
true
alias
Pleroma.Emoji.Loader
describe
"match_extra/2"
do
setup
do
groups
=
[
"list of files"
:
[
"/emoji/custom/first_file.png"
,
"/emoji/custom/second_file.png"
],
"wildcard folder"
:
"/emoji/custom/*/file.png"
,
"wildcard files"
:
"/emoji/custom/folder/*.png"
,
"special file"
:
"/emoji/custom/special.png"
]
{
:ok
,
groups
:
groups
}
end
test
"config for list of files"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/custom/first_file.png"
)
|>
to_string
()
assert
group
==
"list of files"
end
test
"config with wildcard folder"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/custom/some_folder/file.png"
)
|>
to_string
()
assert
group
==
"wildcard folder"
end
test
"config with wildcard folder and subfolders"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/custom/some_folder/another_folder/file.png"
)
|>
to_string
()
assert
group
==
"wildcard folder"
end
test
"config with wildcard files"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/custom/folder/some_file.png"
)
|>
to_string
()
assert
group
==
"wildcard files"
end
test
"config with wildcard files and subfolders"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/custom/folder/another_folder/some_file.png"
)
|>
to_string
()
assert
group
==
"wildcard files"
end
test
"config for special file"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/custom/special.png"
)
|>
to_string
()
assert
group
==
"special file"
end
test
"no matching returns nil"
,
%{
groups
:
groups
}
do
group
=
groups
|>
Loader
.
match_extra
(
"/emoji/some_undefined.png"
)
refute
group
end
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 20, 1:10 PM (1 d, 1 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
855395
Default Alt Text
loader_test.exs (2 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment