Modul:Wikidata/testcases
Vzhled
-- Click talk page to run tests
local p = require 'Modul:UnitTests'
function p:test_label()
self:preprocess_equals_many('{{#invoke:Wikidata|getLabel|id=Q1085', '}}', {
{'', 'Praha'},
{'|lang=cs', 'Praha'},
{'|lang=ru', 'Прага'},
{'|lang=xyz', ''},
})
end
function p:test_sitelink()
self:preprocess_equals_many('{{#invoke:Wikidata|getSitelink|id=Q1085', '}}', {
{'', 'Praha'},
{'', mw.wikibase.sitelink('Q1085')},
{'|cswiki', 'Praha'},
{'|site=cswiki', 'Praha'},
{'|site=ruwiki|pattern=[[:ru:$1]]', '[[:ru:Прага]]'},
})
end
function p:test_description()
self:preprocess_equals('{{#invoke:Wikidata|getDescription|id=Q1085}}', mw.wikibase.description('Q1085'))
end
return p