Module:Reply to/testcases

From blackwiki
< Module:Reply to
Revision as of 08:50, 16 November 2016 by blackwiki>Mr. Stradivarius (start test cases)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Documentation for this module may be created at Module:Reply to/testcases/doc

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