Module:Arrowverse redirect category handler/testcases

Documentation for this module may be created at Module:Arrowverse redirect category handler/testcases/doc

-- Unit tests for [[Module:Arrowverse redirect category handler]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_01_1_testSeriesName_live()
	self:preprocess_equals_many('{{#invoke:Arrowverse redirect category handler|testSeriesName|', '}}', {
		{"", "Arrowverse" },
		{"arrow=yes", "Arrow (TV series)"},
		{"flash=yes", "The Flash (2014 TV series)"},
		{"constantine=yes", "Constantine (TV series)"},
		{"legends=yes", "Legends of Tomorrow"},
		{"supergirl=yes", "Supergirl (TV series)"},
		{"vixen=yes", "Vixen (web series)"},
		{"ray=yes", "Freedom Fighters: The Ray"},
		{"batwoman=yes", "Batwoman (TV series)"},
		{"black_lightning=yes", "Black Lightning (TV series)"},
	})
end

function p:test_01_2_testSeriesName_sandbox()
	self:preprocess_equals_many('{{#invoke:Arrowverse redirect category handler/sandbox|testSeriesName|', '}}', {
		{"", "Arrowverse" },
		{"arrow=yes", "Arrow (TV series)"},
		{"flash=yes", "The Flash (2014 TV series)"},
		{"constantine=yes", "Constantine (TV series)"},
		{"legends=yes", "Legends of Tomorrow"},
		{"supergirl=yes", "Supergirl (TV series)"},
		{"vixen=yes", "Vixen (web series)"},
		{"ray=yes", "Freedom Fighters: The Ray"},
		{"batwoman=yes", "Batwoman (TV series)"},
		{"black_lightning=yes", "Black Lightning (TV series)"},
	})
end

function p:test_02_1_getSeriesList_live()
	self:preprocess_equals('{{#invoke:Arrowverse redirect category handler|getSeriesList}}', 'table')
end

function p:test_02_2_getSeriesList_sandbox()
	self:preprocess_equals('{{#invoke:Arrowverse redirect category handler/sandbox|getSeriesList}}', 'table')
end

function p:test_03_1_getFranchiseName_live()
	self:preprocess_equals('{{#invoke:Arrowverse redirect category handler|getFranchiseName}}', 'Arrowverse')
end

function p:test_03_2_getFranchiseName_sandbox()
	self:preprocess_equals('{{#invoke:Arrowverse redirect category handler/sandbox|getFranchiseName}}', 'Arrowverse')
end

function p:test_04_1_redirect_categories_live()
	self:preprocess_equals_many('{{#invoke:Arrowverse redirect category handler|character|test=yes|', '}}', {
		{"", "R from fictional character, R to section, R with possibilities, R printworthy"},
		{"arrow=yes|flash=yes", "Arrow (TV series), The Flash (2014 TV series), Arrowverse, R from fictional character, R to section, R with possibilities, R printworthy"},
	})
end

function p:test_04_1_redirect_categories_sandbox()
	self:preprocess_equals_many('{{#invoke:Arrowverse redirect category handler/sandbox|character|test=yes|', '}}', {
		{"", "R from fictional character, R to section, R with possibilities, R printworthy"},
		{"arrow=yes|flash=yes", "Arrow (TV series), The Flash (2014 TV series), Arrowverse, R from fictional character, R to section, R with possibilities, R printworthy"},
	})
end

return p