Module:Item infobox/testcases/edible by: Difference between revisions

From Space Station 14 Wiki
Aliser (talk | contribs)
Created page with "local p = require('Module:MyModule') -- the module to be tested local ScribuntoUnit = require('Module:ScribuntoUnit') local suite = ScribuntoUnit:new() local frame = mw.getCurrentFrame() function suite:test_empty() frame.args = {} self:assertEquals('', p.generate_edible_by(frame)) end return suite"
 
Aliser (talk | contribs)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
local p = require('Module:MyModule') -- the module to be tested
local p = require('Module:Item infobox') -- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()
local suite = ScribuntoUnit:new()
Line 9: Line 9:
     self:assertEquals('', p.generate_edible_by(frame))
     self:assertEquals('', p.generate_edible_by(frame))
end
function suite:test_reptilian()
frame.args = {
["edible by reptilians"] = 1
}
    self:assertEquals('<ul><li>Reptilians</li></ul>', p.generate_edible_by(frame))
end
function suite:test_moth()
frame.args = {
["edible by moths"] = 1
}
    self:assertEquals('<ul><li>Moth people</li></ul>', p.generate_edible_by(frame))
end
function suite:test_everyone()
frame.args = {
["edible by reptilians"] = 1,
["edible by moths"] = 1,
["edible by rest"] = 1
}
    self:assertEquals('<ul><li>Everyone</li></ul>', p.generate_edible_by(frame))
end
function suite:test_everyone_except_reptilians()
frame.args = {
["edible by moths"] = 1,
["edible by rest"] = 1
}
    self:assertEquals('<ul><li>Everyone, except:<ul><li>Reptilians</li></ul></li></ul>', p.generate_edible_by(frame))
end
function suite:test_everyone_except_other_options()
frame.args = {
["edible by rest"] = 1
}
    self:assertEquals('<ul><li>Everyone, except:<ul><li>Reptilians</li><li>Moth people</li></ul></li></ul>', p.generate_edible_by(frame))
end
end


return suite
return suite

Latest revision as of 01:35, 4 April 2025

Documentation for this module may be created at Module:Item infobox/testcases/edible by/doc

local p = require('Module:Item infobox') -- the module to be tested
local ScribuntoUnit = require('Module:ScribuntoUnit')
local suite = ScribuntoUnit:new()

local frame = mw.getCurrentFrame()

function suite:test_empty()
	frame.args = {}
	
    self:assertEquals('', p.generate_edible_by(frame))
end

function suite:test_reptilian()
	frame.args = {
		["edible by reptilians"] = 1
	}
	
    self:assertEquals('<ul><li>Reptilians</li></ul>', p.generate_edible_by(frame))
end

function suite:test_moth()
	frame.args = {
		["edible by moths"] = 1
	}
	
    self:assertEquals('<ul><li>Moth people</li></ul>', p.generate_edible_by(frame))
end

function suite:test_everyone()
	frame.args = {
		["edible by reptilians"] = 1,
		["edible by moths"] = 1,
		["edible by rest"] = 1
	}
	
    self:assertEquals('<ul><li>Everyone</li></ul>', p.generate_edible_by(frame))
end

function suite:test_everyone_except_reptilians()
	frame.args = {
		["edible by moths"] = 1,
		["edible by rest"] = 1
	}
	
    self:assertEquals('<ul><li>Everyone, except:<ul><li>Reptilians</li></ul></li></ul>', p.generate_edible_by(frame))
end

function suite:test_everyone_except_other_options()
	frame.args = {
		["edible by rest"] = 1
	}
	
    self:assertEquals('<ul><li>Everyone, except:<ul><li>Reptilians</li><li>Moth people</li></ul></li></ul>', p.generate_edible_by(frame))
end

return suite