Module:GetShortDescription/testcases
Appearance
![]() | This is the test cases page for the module Module:GetShortDescription. Results of the test cases. |
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Run tests on the talk page.
-- Due to the nature of short descriptions; these tests may need to be updated before running them.
local p = require('Module:UnitTests')
function p:test_name__explicit_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=The Partisan}}', "1943 song by Anna Marly and Emmanuel d'Astier, popularised by Leonard Cohen in 1969")
end
function p:test_name__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Author, Author (Star Trek: Voyager)}}', "episode of Star Trek: Voyager (S7 E20)")
end
function p:test_name_only_explicit__explicit_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=The Partisan|only=explicit}}', "1943 song by Anna Marly and Emmanuel d'Astier, popularised by Leonard Cohen in 1969")
end
function p:test_name_only_explict__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Author, Author (Star Trek: Voyager)|only=explicit}}', "")
end
function p:test_name_only_wikidata()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=The Partisan|only=wikidata}}', "song composed by Anna Marly with lyrics by Emmanuel d'Astier de La Vigerie performed by Leonard Cohen")
end
function p:test_name_prefer_explicit__explicit_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=The Partisan|prefer=explicit}}', "1943 song by Anna Marly and Emmanuel d'Astier, popularised by Leonard Cohen in 1969")
end
function p:test_name_prefer_explicit__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Author, Author (Star Trek: Voyager)|prefer=explicit}}', "episode of Star Trek: Voyager (S7 E20)")
end
function p:test_name_prefer_wikidata__explicit_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=The Partisan|prefer=wikidata}}', "song composed by Anna Marly with lyrics by Emmanuel d'Astier de La Vigerie performed by Leonard Cohen")
end
function p:test_name_prefer_wikidata__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Author, Author (Star Trek: Voyager)|prefer=explicit}}', "episode of Star Trek: Voyager (S7 E20)")
end
return p
--{{#invoke:GetShortDescription|main |name= |only= |prefer= |fallback= |lang_italic= |lang_nocat= |lang_size= |lang_cat= |lang_rtl= |lang_no= }}