Модуль:Песочница/Solidest/Infobox television season name/тесты

Материал из Википедии — свободной энциклопедии
Перейти к навигации Перейти к поиску
Документация
-- Unit tests for [[Module:Песочница/Solidest/Infobox television season name]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_01_checkPrevSeason()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'isPrevSeasonLinkValid', {
		{'title=Big Brother 2 (American season)', "true"},
		{'title=Lost (season 2)', "true"},
		{'title=The Office (American season 2)', "true"},
		{'title=The X Factor (British series 2)', "true"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "true"},
		{'title=Love Island (2015 TV series, series 2)', "true"},
		{'title=Big Brother Brasil 2', "true"},
		{'title=Big Brother 55 (American season)', ""},
		{'title=Lost (season 55)', ""},
		{'title=The Office (American season 55)', ""},
		{'title=The X Factor (British series 55)', ""},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 55)', ""}
	})
end

function p:test_02_checkNextSeason()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'isNextSeasonLinkValid', {
		{'title=Big Brother 2 (American season)', "true"},
		{'title=Lost (season 2)', "true"},
		{'title=The Office (American season 2)', "true"},
		{'title=The X Factor (British series 2)', "true"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "true"},
		{'title=Love Island (2015 TV series, series 2)', "true"},
		{'title=Big Brother Brasil 2', "true"},
		{'title=Big Brother 55 (American season)', ""},
		{'title=Lost (season 55)', ""},
		{'title=The Office (American season 55)', ""},
		{'title=The X Factor (British series 55)', ""},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 55)', ""}
	})
end

function p:test_03_checkAll()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'isPrevOrNextSeasonLinkValid', {
		{'title=Big Brother 2 (American season)', "true"},
		{'title=Lost (season 2)', "true"},
		{'title=The Office (American season 2)', "true"},
		{'title=The X Factor (British series 2)', "true"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "true"},
		{'title=Love Island (2015 TV series, series 2)', "true"},
		{'title=Big Brother Brasil 2', "true"},
		{'title=Big Brother 55 (American season)', ""},
		{'title=Lost (season 55)', ""},
		{'title=The Office (American season 55)', ""},
		{'title=The X Factor (British series 55)', ""},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 55)', ""}
	})
end

function p:test_04_getPrevSeasonArticle()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'getPrevSeasonArticle', {
		{'title=Big Brother 2 (American season)', "[[Big Brother 1 (American season)|Season 1]]"},
		{'title=Lost (season 2)', "[[Lost (season 1)|Season 1]]"},
		{'title=The Office (American season 2)', "[[The Office (American season 1)|Season 1]]"},
		{'title=The X Factor (British series 2)', "[[The X Factor (British series 1)|Series 1]]"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "[[Teenage Mutant Ninja Turtles (1987 TV series, season 1)|Season 1]]"},
		{'title=Love Island (2015 TV series, series 2)', "[[Love Island (2015 TV series, series 1)|Series 1]]"},
		{'title=Big Brother Brasil 2', "[[Big Brother Brasil 1]]"},
	})
end

function p:test_05_getNextSeasonArticle()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'getNextSeasonArticle', {
		{'title=Big Brother 2 (American season)', "[[Big Brother 3 (American season)|Season 3]]"},
		{'title=Lost (season 2)', "[[Lost (season 3)|Season 3]]"},
		{'title=The Office (American season 2)', "[[The Office (American season 3)|Season 3]]"},
		{'title=The X Factor (British series 2)', "[[The X Factor (British series 3)|Series 3]]"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "[[Teenage Mutant Ninja Turtles (1987 TV series, season 3)|Season 3]]"},
		{'title=Love Island (2015 TV series, series 2)', "[[Love Island (2015 TV series, series 3)|Series 3]]"},
		{'title=Big Brother Brasil 2', "[[Big Brother Brasil 3]]"},
	})
end

function p:test_06_getSeasonWord()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'getSeasonWord', {
		{'title=Big Brother 2 (American season)', "season"},
		{'title=Lost (season 2)', "season"},
		{'title=The Office (American season 2)', "season"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "season"},
		{'title=Doctor Who (series 2)', "series"},
		{'title=The X Factor (British series 2)', "series"},
		{'title=Love Island (2015 TV series, series 2)', "series"},
		{'title=Ben 10: Omniverse (story arc 1)', "story arc"},
		{'title=Big Brother Brasil 2', ""},
		{'Doctor Who (2008–2010 specials)', ""},
	})
end

function p:test_07_getInfoboxSubHeader()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'getInfoboxSubHeader', {
		{'title=Big Brother 2 (American season)', ""},
		{'title=Lost (season 2)', "Season 2"},
		{'title=The Office (American season 2)', "Season 2"},
		{'title=Teenage Mutant Ninja Turtles (1987 TV series, season 2)', "Season 2"},
		{'title=Doctor Who (series 2)', "Series 2"},
		{'title=The X Factor (British series 2)', "Series 2"},
		{'title=Love Island (2015 TV series, series 2)', "Series 2"},
		{'title=Big Brother Brasil 2', ""},
		{'title=Lost (season 2)|series_number=2', "Series 2"},
		{'title=Lost (season 2)|series_number=5', "Series 5"},
		{'title=Ben 10: Omniverse (story arc 1)', "Story arc 1"},
		{'title=Doctor Who (2008–2010 specials)', "2008–2010 specials"},
	})
end

function p:test_08_getListOfEpisodes()
	self:preprocess_equals_sandbox_many('{{#invoke:Песочница/Solidest/Infobox television season name', 'getListOfEpisodes', {
		{'title=Lost (season 1)', "[[List of Lost episodes|List of episodes]]"},
		{'title=Lost (season 1)|link=List of Lost episodes', "[[List of Lost episodes|List of episodes]]"},
		{'title=Teenage Mutant Ninja Turtles (2012 TV series, season 1)', "[[List of Teenage Mutant Ninja Turtles (2012 TV series) episodes|List of episodes]]"},
		{'title=Teenage Mutant Ninja Turtles (2012 TV series, season 1)|link=List of Teenage Mutant Ninja Turtles (2012 TV series) episodes', "[[List of Teenage Mutant Ninja Turtles (2012 TV series) episodes|List of episodes]]"},
		{'title=The Simpsons (season 1)', "[[List of The Simpsons episodes|List of episodes]]"},
		{'title=The Simpsons (season 1)|link=List of The Simpsons episodes (seasons 1–20)', "[[List of The Simpsons episodes (seasons 1–20)|List of episodes]]"},
		{'title=Doctor Who (season 1)', "[[List of Doctor Who episodes|List of episodes]]"},
		{'title=Doctor Who (season 1)|link=List of Doctor Who episodes (2005–present)', "[[List of Doctor Who episodes (2005–present)|List of episodes]]"},
		{'title=Strike the Blood II|link=List of Strike the Blood episodes', "[[List of Strike the Blood episodes|List of episodes]]"},
		{"title=Lost (season 1)|link=List of Lost episodes|List of ''Lost'' episodes", "[[List of Lost episodes|List of episodes]]"},
		{'title=Lost (season 1)|link=[[List of Lost episodes]]', "[[List of Lost episodes|List of episodes]]"},
		{'title=Lost (season 1)|link=[[List of Lost episodes|List of Lost episodes]]', "[[List of Lost episodes|List of episodes]]"},
		{'title=Top Gear (American season 2)', "[[List of Top Gear (American TV series) episodes|List of episodes]]"},
		{'title=Top Gear (American season 2)|link=List of Top Gear (U.S.) episodes', "[[List of Top Gear (U.S.) episodes|List of episodes]]"},
		{'title=Lost (season 1)|link=x', "[[x|List of episodes]]"},
		{'title=Back to Reality (TV series)', ""},
		{'title=MTV Roadies (season 18)|link=https://bn.m.wikipedia.org/wiki/%E0%A6%AC%E0%A6%BE%E0%A6%82%E0%A6%B2%E0%A6%BE%E0%A6%A6%E0%A7%87%E0%A6%B6', ""},
	}, {nowiki=1})
end

return p