Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Mainspace editnotice/testcases

From Wikipedia, the free encyclopedia
-- 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