Jump to content

Module:PopulationFromWikidata/testcases

From Wikipedia, the free encyclopedia
--Test cases for the sandbox version of the PopulationFromWikidata module. This is a Lua module for testing the sandbox module.

-- we inherit p from another module
-- UnitTests is a system of testing modules. We'll expose the outputs of tests. 
-- We want to specify the expected output to compare to the actual. But for now we're not using this comparison, we're just checking the output manually.
local p = require("module:UnitTests")
function p:test1()
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox}}', '')
--	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571}}', '', {nowiki=1})
--	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571}}', '<div>\n* 2,051 (Suburbs and Localities 2021)<ref></ref></div>[[Category:Australian place articles using Wikidata population values]]')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571}}', '')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571|type = suburb}}', '')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571|type = Suburb}}', '')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q2821571|type = town}}', '')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q649969|type = region}}', '')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q11568|type = city}}', '')
	self:preprocess_equals('{{#invoke:PopulationFromWikidata/sandbox|ListForInfobox|wikidata=Q5174266|type = town}}', '')
	
end


return p