Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F116312
extension_test.exs
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
extension_test.exs
View Options
defmodule
Majic.ExtensionTest
do
use
ExUnit.Case
alias
Majic.Extension
test
"it fixes extensions"
do
assert
"Makefile"
==
Extension
.
fix
(
"Makefile.txt"
,
"text/x-makefile"
)
assert
"cat.webp"
==
Extension
.
fix
(
"cat.jpeg"
,
"image/webp"
)
end
test
"it appends extensions"
do
assert
"Makefile"
==
Extension
.
fix
(
"Makefile.txt"
,
"text/x-makefile"
,
append
:
true
)
assert
"cat.jpeg.webp"
==
Extension
.
fix
(
"cat.jpeg"
,
"image/webp"
,
append
:
true
)
end
test
"it appends extensions if none exist"
do
assert
"webpage.html"
==
Extension
.
fix
(
"webpage"
,
"text/html"
,
append
:
true
)
end
test
"it does not append extension if none exist when appending not requested"
do
assert
"webpage"
==
Extension
.
fix
(
"webpage"
,
"text/html"
)
end
test
"it uses subtype as extension"
do
assert
"Makefile.x-makefile"
==
Extension
.
fix
(
"Makefile.txt"
,
"text/x-makefile"
,
subtype_as_extension
:
true
)
assert
"cat.webp"
==
Extension
.
fix
(
"cat.jpeg"
,
"image/webp"
,
subtype_as_extension
:
true
)
end
test
"it appends and use subtype"
do
assert
"Makefile.txt.x-makefile"
==
Extension
.
fix
(
"Makefile.txt"
,
"text/x-makefile"
,
subtype_as_extension
:
true
,
append
:
true
)
assert
"cat.jpeg.webp"
==
Extension
.
fix
(
"cat.jpeg"
,
"image/webp"
,
subtype_as_extension
:
true
,
append
:
true
)
end
end
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 1, 6:10 AM (1 d, 19 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41608
Default Alt Text
extension_test.exs (1 KB)
Attached To
Mode
R20 majic
Attached
Detach File
Event Timeline
Log In to Comment