Jump to content

Module:Mainspace editnotice/testcases: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
fix 1, add 1
unbreak tfa test
 
Line 1: Line 1:
-- Unit tests for [[Module:Mainspace editnotice]]. Click talk page to run tests.
-- Unit tests for [[Module:Mainspace editnotice]]. Click talk page to run tests.


local TfaTitle = require('Module:TFA title')
local ScribuntoUnit = require('Module:ScribuntoUnit')
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()
local suite = ScribuntoUnit:new()
Line 30: Line 31:


function suite:testTfa()
function suite:testTfa()
local TfaTitle = require('Module:TFA title')
self:assertNoticeEquals(TfaTitle.today_title(), '{{TFA editnotice}}')
self:assertNoticeEquals(TfaTitle.today_title(), '{{TFA editnotice}}')
end
end

Latest revision as of 03:55, 3 February 2024

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

local TfaTitle = require('Module:TFA title')
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:testTfa()
	self:assertNoticeEquals(TfaTitle.today_title(), '{{TFA editnotice}}')
end

function suite:testDraft()
	-- Disambig page having a draft page
	self:assertNoticeEquals('Example', '{{Disambig editintro}}{{Draft at}}')
end

return suite