Modulo:Wikidata/b2/pangsubok

Manipud iti Wikipedia, ti nawaya nga ensiklopedia
Darsen a mapan iti pagdaliasatan Darsen a mapan agbiruk
local p = require 'Modulo:UnitTests'

function p:test_label()
	self:preprocess_equals_many('{{#invoke:Wikidata/b2|getLabel|id=Q1085', '}}', {
		{'', 'Prague'},
		{'|lang=ilo', 'Prague'},
		{'|lang=es', 'Praga'},
		{'|lang=xyz', ''},
	})
end

function p:test_sitelink()
	self:preprocess_equals_many('{{#invoke:Wikidata/b2|getSitelink|id=Q1085', '}}', {
		{'', 'Prague'},
		{'', mw.wikibase.sitelink('Q1085')},
		{'|ilowiki', 'Prague'},
		{'|site=ilowiki', 'Prague'},
		{'|site=eswiki|pattern=[[:es:$1]]', '[[:es:Praga]]'},
	})
end

function p:test_description()
	self:preprocess_equals('{{#invoke:Wikidata/b2|getDescription|id=Q1085}}', mw.wikibase.description('Q1085'))
end

function p:test_badges()
	self:preprocess_equals_many('{{#invoke:Wikidata/b2|getBadges|id=', '}}', {
		{'Q516233|site=enwiki', mw.wikibase.label('Q17437796')},
		{'Q2495041|site=enwiki', mw.wikibase.label('Q17437798')},
		{'Q1085|site=foowiki', ''},
	})
end

return p