Module:Item infobox/testcases/edible by

From Space Station 14 Wiki

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