Jump to content

Module:Page assessment/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Evad37 (talk | contribs) at 03:40, 30 December 2020 (fixes). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Unit tests for [[Module:Page assessment}}]]. Click talk page to run tests.
local ScribuntoUnit = require('Module:ScribuntoUnit')
local liveMod = require('Module:Page assessment').util -- the module to be tested
local sandbox = require('Module:Page assessment/sandbox').test -- the module to be tested

local suite = ScribuntoUnit:new()

function suite:testGetWikitext()
	-- From article
	local subjectWikitext, talkWikitext = liveMod.getWikitext("Wikipedia")
    self:assertTrue(mw.ustring.len(subjectWikitext) > 100, "Wikitext of page 'Wikipedia' more than 100 chars")
    self:assertTrue(mw.ustring.len(subjectWikitext) > 100, "Wikitext of page 'Talk:Wikipedia' more than 100 chars")
    self:assertFalse(subjectWikitext == talkWikitext, "Subject page is different to talk page")
end

function suite:testGetWikitext_sandbox()
	-- From article
	local subjectWikitext, talkWikitext = sandbox.getWikitext("Wikipedia")
    self:assertTrue(mw.ustring.len(subjectWikitext) > 100, "Wikitext of page 'Wikipedia' more than 100 chars")
    self:assertTrue(mw.ustring.len(subjectWikitext) > 100, "Wikitext of page 'Talk:Wikipedia' more than 100 chars")
    self:assertFalse(subjectWikitext == talkWikitext, "Subject page is different to talk page")
end

--[[
function suite:testSomeOtherCall()
    self:assertEquals('expected value', myModule.someOtherCall(123))
    self:assertEquals('other expected value', myModule.someOtherCall(456))
end
]]--

return suite