Module:Page assessment/testcases: Difference between revisions
Appearance
Content deleted Content added
fixes |
test getting wikitext of non-existent page |
||
Line 6: | Line 6: | ||
local suite = ScribuntoUnit:new() |
local suite = ScribuntoUnit:new() |
||
function suite:testGetWikitext() |
function suite:testGetWikitext(modToTest) |
||
-- From article |
-- From article |
||
modToTest = modToTest or liveMod |
|||
local subjectWikitext, talkWikitext = |
local subjectWikitext, talkWikitext = modToTest.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 'Wikipedia' more than 100 chars") |
||
self:assertTrue(mw.ustring.len(subjectWikitext) > 100, "Wikitext of page 'Talk: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") |
self:assertFalse(subjectWikitext == talkWikitext, "Subject page is different to talk page") |
||
end |
|||
function suite:testGetWikitext__sandbox() |
|||
self:testGetWikitext(sandbox) |
|||
end |
end |
||
function suite: |
function suite:testGetWikitext_nonexisting(modToTest) |
||
modToTest = modToTest or liveMod |
|||
-- From article |
|||
local subjectWikitext, talkWikitext = |
local subjectWikitext, talkWikitext = modToTest.getWikitext("Wikipediadsgvbjfdoibtdhbntrsnsr") |
||
self: |
self:assertEquals(subjectWikitext, nil, "Nil result for subject page wikitext") |
||
self:assertEquals(talkWikitext, nil, "Nil result for talk page wikitext") |
|||
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 |
end |
||
function suite:testGetWikitext_nonexisting__sandbox() return self:testGetWikitext_nonexisting(sandbox) end |
|||
--[[ |
--[[ |
Revision as of 03:49, 30 December 2020
![]() | This is the test cases page for the module Module:Page assessment. Results of the test cases. |
-- 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(modToTest)
-- From article
modToTest = modToTest or liveMod
local subjectWikitext, talkWikitext = modToTest.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()
self:testGetWikitext(sandbox)
end
function suite:testGetWikitext_nonexisting(modToTest)
modToTest = modToTest or liveMod
local subjectWikitext, talkWikitext = modToTest.getWikitext("Wikipediadsgvbjfdoibtdhbntrsnsr")
self:assertEquals(subjectWikitext, nil, "Nil result for subject page wikitext")
self:assertEquals(talkWikitext, nil, "Nil result for talk page wikitext")
end
function suite:testGetWikitext_nonexisting__sandbox() return self:testGetWikitext_nonexisting(sandbox) end
--[[
function suite:testSomeOtherCall()
self:assertEquals('expected value', myModule.someOtherCall(123))
self:assertEquals('other expected value', myModule.someOtherCall(456))
end
]]--
return suite