Jump to content

Module:Reply to/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Mr. Stradivarius (talk | contribs) at 08:50, 16 November 2016 (start test cases). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
local mReplyTo = require('Module:Reply to') -- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()

local frame = mw.getCurrentFrame()

local function makeFrameWithParentArgs(args)
	local parent = frame:newChild{title = 'Template:Reply to', args = args}
	local child = parent:newChild{title = 'Module:Reply to'}
	return child
end

local function replyTo(args)
	return mReplyTo.replyto(makeFrameWithParentArgs(args))
end

--------------------------------------------------------------------------------
-- Error tests
--------------------------------------------------------------------------------

function suite:testNoUsernamesError()
    self:assertEquals('<strong class="error">Error in [[Template:Reply to]]: Username not given.</strong>', replyTo{})
end

return suite