Module:GetShortDescription/testcases: Difference between revisions

Content deleted Content added
fix test expectations since change to named article's SD
few fixes
 
(2 intermediate revisions by the same user not shown)
Line 15:
 
function p:test__no_only_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=}}', "Explicit short description")
end
 
function p:test__no_prefer_value()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|prefer=}}', "Explicit short description")
end
 
Line 29:
 
function p:test__nonexistent_page_name()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=User:FredIntentionally Gandt/nonexistentpermanent pagered link}}', '')
end
 
Line 35:
 
function p:test__unknown_param_with_no_value_offered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|unknown=}}', "Explicit short description")
end
 
function p:test__unknown_param_with_value_offered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|unknown=unknown}}', "Explicit short description")
end
 
Line 45:
 
function p:test__unknown_param_found()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description with unknown params}}', "Explicit short description with unknown params")
end
 
function p:test__complex_unknown_params_found()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description with complex unknown params}}', "Explicit short description with complex unknown params")
end
 
Line 57:
 
function p:test__two_short_descriptions_numbered_after()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/two explicit short descriptions numbered after}}', "Explicit short description numbered second (used)")
end
 
function p:test__two_short_descriptions_numbered_before()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/two explicit short descriptions numbered before}}', "Explicit short description unnumbered second (used)")
end
 
Line 67:
 
function p:test__two_short_description_templates()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/two explicit short description templates}}', "Explicit short description second (used)")
end
 
function p:test__two_short_description_templates__first_noreplace()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/two explicit short description templates first noreplace}}', "Explicit short description second (used)")
end
 
function p:test__two_short_description_templates__second_noreplace()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/two explicit short description templates second noreplace}}', "Explicit short description first (used)")
end
 
function p:test__three_short_description_templates__second_noreplace()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/three explicit short description templates second noreplace}}', "Explicit short description third (used)")
end
 
function p:test__three_short_description_templates__second_none__third_noreplace()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/three explicit short description templates second none third noreplace}}', "Explicit short description first (used)")
end
 
Line 89:
 
function p:test__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description}}', "Explicit short description")
end
 
function p:test__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description}}', "")
end
 
function p:test__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia}}', "Free online crowd-sourcedcrowdsourced encyclopedia")
end
 
Line 107:
 
function p:test__only_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=explicit}}', "Explicit short description")
end
 
function p:test__only_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=wikidata}}', "")
end
 
function p:test__only_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|only=explicit}}', "")
end
 
function p:test__only_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|only=wikidata}}', "")
end
 
function p:test__only_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|only=explicit}}', "Free online crowd-sourcedcrowdsourced encyclopedia")
end
 
Line 141:
 
function p:test__prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|prefer=explicit}}', "Explicit short description")
end
 
function p:test__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|prefer=wikidata}}', "Explicit short description")
end
 
function p:test__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|prefer=explicit}}', "")
end
 
function p:test__prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|prefer=wikidata}}', "")
end
 
function p:test__prefer_explicit__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|prefer=explicit}}', "Free online crowd-sourcedcrowdsourced encyclopedia")
end
 
Line 176:
 
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=explicit|prefer=wikidata}}', "Explicit short description")
end
 
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|only=explicit|prefer=wikidata}}', "")
end
 
function p:test__conflicting__only_explicit__prefer_wikidata__explicit_exists__wikidata_exists()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=Wikipedia|only=explicit|prefer=wikidata}}', "freeFree online crowd-sourcedcrowdsourced encyclopedia")
end
 
Line 194:
 
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_exists__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description|only=wikidata|prefer=explicit}}', "")
end
 
function p:test__conflicting__only_wikidata__prefer_explicit__explicit_does_not_exist__wikidata_does_not_exist()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/no explicit short description|only=wikidata|prefer=explicit}}', "")
end
 
Line 212:
 
function p:test__only_explicit__undefined()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description undefined|only=explicit}}', "")
end
 
function p:test__only_explicit__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description empty|only=explicit}}', "")
end
 
function p:test__only_explicit__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description none|only=explicit}}', "none")
end
 
function p:test__only_explicit__numbered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description numbered|only=explicit}}', "Explicit short description numbered")
end
 
function p:test__only_explicit__complex()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex|only=explicit}}', "Explicit short description complex")
end
 
function p:test__only_explicit__complex__numbered()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex numbered|only=explicit}}', "Explicit short description complex numbered")
end
 
function p:test__only_explicit__numbered__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description numbered empty|only=explicit}}', "")
end
 
function p:test__only_explicit__numbered__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description numbered none|only=explicit}}', "none")
end
 
function p:test__only_explicit__complex__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex empty|only=explicit}}', "")
end
 
function p:test__only_explicit__complex__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex none|only=explicit}}', "none")
end
 
function p:test__only_explicit__complex__numbered__empty()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex numbered empty|only=explicit}}', "")
end
 
function p:test__only_explicit__complex__numbered__none()
self:preprocess_equals('{{#invoke:GetShortDescription|main|stringify=yes|name=UserTemplate:Fred Gandt/sandboxGetShortDescription/explicit short description complex numbered none|only=explicit}}', "none")
end