Jump to content

Module:Mainspace editnotice/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
switch to ScribuntoUnit
expand testcases
Line 13: Line 13:


function suite:testBlp()
function suite:testBlp()
-- In [[Category:Living people]]
self:assertNoticeEquals('Barack Obama', '{{BLP editintro}}')
self:assertNoticeEquals('Barack Obama', '{{BLP editintro}}')
-- In [[Category:Possibly living people]]
self:assertNoticeEquals('Earl Ashby', '{{BLP editintro}}')
end

function suite:testDisambig()
self:assertNoticeEquals('1998 hurricane season', '{{Disambig editintro}}')
self:assertNoticeEquals('M31', '{{Disambig editintro}}')
end

function suite:testRefideas()
self:assertNoticeEquals('Mobile Suit Victory Gundam', '{{Refideas editnotice}}')
end

function suite:testDraft()
self:assertNoticeEquals('More Than I Want to Remember', '{{Draft at}}')
end
end



Revision as of 19:37, 31 January 2024

-- Unit tests for [[Module:Mainspace editnotice]]. Click talk page to run tests.

local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()

function suite:assertNoticeEquals(page, notice)
	self:assertEquals(
		mw.text.killMarkers(suite.frame:preprocess(notice)), 
		mw.text.killMarkers(suite.frame:preprocess(
			'{{#invoke:Mainspace editnotice|main|page='..page..'}}'))
	)
end

function suite:testBlp()
	-- In [[Category:Living people]]
	self:assertNoticeEquals('Barack Obama', '{{BLP editintro}}')
	
	-- In [[Category:Possibly living people]]
	self:assertNoticeEquals('Earl Ashby', '{{BLP editintro}}')
end

function suite:testDisambig()
	self:assertNoticeEquals('1998 hurricane season', '{{Disambig editintro}}')
	self:assertNoticeEquals('M31', '{{Disambig editintro}}')
end

function suite:testRefideas()
	self:assertNoticeEquals('Mobile Suit Victory Gundam', '{{Refideas editnotice}}')
end

function suite:testDraft()
	self:assertNoticeEquals('More Than I Want to Remember', '{{Draft at}}')
end

return suite