Module:GetShortDescription/testcases: Difference between revisions

Content deleted Content added
saving in incomplete state due to need to shut computer down
saving for a quick test
Line 3:
 
local p = require('Module:UnitTests')
 
--[[ empty params ]]
 
function p:no_name_param()
Line 12 ⟶ 14:
end
 
function p:explicit_existsno_only_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|only=}}', "explicit short description")
end
 
function p:explicit_does_not_exist__wikidata_existsno_prefer_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=ExampleUser:Fred Gandt/sandbox/explicit short description|prefer=}}', "Wikimediaexplicit disambiguationshort pagedescription")
end
 
function p:no_fallback_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|onlyfallback=wikidata}}', "")
end
 
--[[ none but name ]]
 
function p:explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|prefer=wikidataUser:Fred Gandt/sandbox/explicit short description}}', "Free multilingual, online,explicit crowdsourcedshort encyclopediadescription")
end
 
Line 24 ⟶ 36:
end
 
function p:only_explicit__explicit_existsexplicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia}}', "Free multilingual, online, crowdsourced encyclopedia")
end
 
function p:explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Example}}', "Wikimedia disambiguation page")
end
 
--[[ name and only ]]
 
function p:only_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|only=explicit}}', "explicit short description")
end
 
function p:only_wikidata__explicit_exists__wikidata_does_not_exist()
function p:only_explict__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|only=wikidata}}', "")
end
 
function p:only_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|only=explicit}}', "")
end
 
function p:only_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
function p:only_wikidata__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|only=wikidata}}', "")
end
 
function p:only_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|only=explicit}}', "Free multilingual, online, crowdsourced encyclopedia")
end
 
function p:only_wikidata__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|only=wikidata}}', "free multilingual online encyclopedia")
end
 
function p:only_explicit__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Example|only=explicit}}', "")
end
 
function p:only_wikidata__explicit_does_not_exist__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Example|only=wikidata}}', "Wikimedia disambiguation page")
end
 
--[[ name and prefer ]]
function p:only_wikidata__wikidata_does_not_exist()
 
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|only=wikidata}}', "")
function p:prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|prefer=explicit}}', "explicit short description")
end
 
function p:prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short description|prefer=wikidata}}', "explicit short description")
end
 
function p:prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|prefer=explicit}}', "")
end
 
function p:prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/no explicit short description|prefer=wikidata}}', "")
end
 
Line 44 ⟶ 100:
end
 
function p:prefer_wikidata__explicit_exists__wikidata_exists()
function p:prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=User:Fred Gandt/sandbox/explicit short descriptionWikipedia|prefer=explicitwikidata}}', "explicitfree multilingual shortonline descriptionencyclopedia")
end
 
Line 52 ⟶ 108:
end
 
function p:prefer_wikidata__explicit_does_not_exist__wikidata_exists()
function p:prefer_wikidata__wikidata_exists__explicit_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Wikipedia|prefer=wikidata}}', "Free multilingual, online, crowdsourced encyclopedia")
end
 
function p:prefer_wikidata__wikidata_exists__explicit_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|name=Example|prefer=wikidata}}', "Wikimedia disambiguation page")
end
 
 
 
 
--[[ everything below here is being replaced ]]
 
------------------------