-- Unit tests for [[Module:Infobox television season name]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_01_isPrevSeasonLinkValid()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'isPrevSeasonLinkValid', {
{'title=Big Brother 2 (American season)', "true"},
{'title=Lost season 2', "true"},
{'title=The Office (American TV series) season 2', "true"},
{'title=The X Factor (British TV series) series 2', "true"},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 2', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 9', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 10', "true"},
{'title=Love Island (2015 TV series) series 2', "true"},
{'title=Big Brother Brasil 2', "true"},
{'title=66th NHK Kōhaku Uta Gassen', "true"},
{'title=Big Brother 55 (American season)', ""},
{'title=Lost (season 55)', ""},
{'title=The Office (American TV series) season 55', ""},
{'title=The X Factor (British TV series) series 55', ""},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 55', ""},
{"title=Channel 4's Comedy Gala (2010 TV program)", ""},
})
end
function p:test_02_isNextSeasonLinkValid()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'isNextSeasonLinkValid', {
{'title=Big Brother 2 (American season)', "true"},
{'title=Lost season 2', "true"},
{'title=The Office (American TV series) season 2', "true"},
{'title=The X Factor (British TV series) series 2', "true"},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 2', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 9', "true"},
-- {'title=Hawaii Five-0 (2010 TV series) season 10', "true"}, -- no article
{'title=Love Island (2015 TV series) series 2', "true"},
{'title=Big Brother Brasil 2', "true"},
{'title=66th NHK Kōhaku Uta Gassen', "true"},
{'title=Big Brother 55 (American season)', ""},
{'title=Lost (season 55)', ""},
{'title=The Office (American TV series) season 55', ""},
{'title=The X Factor (British TV series) series 55', ""},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 55', ""},
{"title=Channel 4's Comedy Gala (2010 TV program)", ""},
})
end
function p:test_03_isPrevOrNextSeasonLinkValid()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'isPrevOrNextSeasonLinkValid', {
{'title=Big Brother 2 (American season)', "true"},
{'title=Lost season 2', "true"},
{'title=The Office (American TV series) season 2', "true"},
{'title=The X Factor (British TV series) series 2', "true"},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 2', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 9', "true"},
{'title=Hawaii Five-0 (2010 TV series) season 10', "true"},
{'title=Love Island (2015 TV series) series 2', "true"},
{'title=Big Brother Brasil 2', "true"},
{'title=66th NHK Kōhaku Uta Gassen', "true"},
{'title=Big Brother 55 (American season)', ""},
{'title=Lost (season 55)', ""},
{'title=The Office (American TV series) season 55', ""},
{'title=The X Factor (British TV series) series 55', ""},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 55', ""},
{"title=Channel 4's Comedy Gala (2010 TV program)", ""},
})
end
function p:test_04_getPrevSeasonArticle()
self:preprocess_equals_sandbox_many('{{#invoke: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 TV series) season 2', "[[The Office (American TV series) season 1|Season 1]]"},
{'title=The X Factor (British TV series) series 2', "[[The X Factor (British TV series) 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=Hawaii Five-0 (2010 TV series) season 2', "[[Hawaii Five-0 (2010 TV series) season 1|Season 1]]"},
{'title=Hawaii Five-0 (2010 TV series) season 9', "[[Hawaii Five-0 (2010 TV series) season 8|Season 8]]"},
{'title=Hawaii Five-0 (2010 TV series) season 10', "[[Hawaii Five-0 (2010 TV series) season 9|Season 9]]"},
{'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]]"},
{'title=66th NHK Kōhaku Uta Gassen', "[[66th NHK Kōhaku Uta Gassen|65th]]"},
{"title=Channel 4's Comedy Gala (2010 TV program)", ""},
})
end
function p:test_05_getNextSeasonArticle()
self:preprocess_equals_sandbox_many('{{#invoke: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 TV series) season 2', "[[The Office (American TV series) season 3|Season 3]]"},
{'title=The X Factor (British TV series) series 2', "[[The X Factor (British TV series) 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=Hawaii Five-0 (2010 TV series) season 2', "[[Hawaii Five-0 (2010 TV series) season 3|Season 3]]"},
{'title=Hawaii Five-0 (2010 TV series) season 9', "[[Hawaii Five-0 (2010 TV series) season 10|Season 10]]"},
{'title=Hawaii Five-0 (2010 TV series) season 10', "[[Hawaii Five-0 (2010 TV series) season 11|Season 11]]"},
{'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]]"},
{'title=66th NHK Kōhaku Uta Gassen', "[[66th NHK Kōhaku Uta Gassen|67th]]"},
{"title=Channel 4's Comedy Gala (2010 TV program)", ""},
})
end
function p:test_06_getSeasonWord()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'getSeasonWord', {
{'title=Big Brother 2 (American season)', "season"},
{'title=Lost season 2', "season"},
{'title=The Office American TV series) season 2', "season"},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "season"},
{'title=Hawaii Five-0 (2010 TV series) season 2', "season"},
{'title=Doctor Who series 2', "series"},
{'title=The X Factor (British TV series) 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', "season"},
{'title=Doctor Who specials (2008–2010)', "specials"},
{'title=66th NHK Kōhaku Uta Gassen', ""},
})
end
function p:test_07_getItalicTitle()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'getItalicTitle', {
-- {'title=Big Brother 2 (American season)', "Season 2"},
-- {'title=Lost season 2', "Season 2"},
-- {'title=The Office (American TV series) season 2', "Season 2"},
-- {'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "Season 2"},
-- {'title=Hawaii Five-0 (2010 TV series) season 2', "Season 2"},
-- {'title=Doctor Who series 2', "Series 2"},
-- {'title=The X Factor (British TV series) series 2', "Series 2"},
-- {'title=Love Island (2015 TV series) series 2', "Series 2"},
-- {'title=Big Brother Brasil 2', "Season 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 specials (2008–2010)', "2008–2010 specials"},
-- {'title=66th NHK Kōhaku Uta Gassen', ""},
})
end
function p:test_08_getAboveTitle()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'getAboveTitle', {
{'title=Big Brother 2 (American season)', "Big Brother"},
{'title=Lost season 2', "Lost"},
{'title=The Office (American TV series) season 2', "The Office"},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "Teenage Mutant Ninja Turtles"},
{'title=Hawaii Five-0 (2010 TV series) season 2', "Hawaii Five-0"},
{'title=Doctor Who series 2', "Doctor Who"},
{'title=The X Factor (British TV series) series 2', "The X Factor"},
{'title=Love Island (2015 TV series) series 2', "Love Island"},
{'title=Big Brother Brasil 2', "Big Brother Brasil"},
{'title=Big Brother Brasil 2|series_number=2', "Big Brother Brasil"},
{'title=Lost season 2|series_number=2', "Lost"},
{'title=Lost season 2|series_number=5', "Lost"},
{'title=Ben 10: Omniverse story arc 1', "Ben 10: Omniverse"},
{'title=Doctor Who specials (2008–2010)', "Doctor Who"},
{'title=66th NHK Kōhaku Uta Gassen', ""},
})
end
function p:test_09_getSubHeader()
self:preprocess_equals_sandbox_many('{{#invoke:Infobox television season name', 'getSubHeader', {
{'title=Big Brother 2 (American season)', "Season 2"},
{'title=Lost season 2', "Season 2"},
{'title=The Office (American TV series) season 2', "Season 2"},
{'title=Teenage Mutant Ninja Turtles (1987 TV series) season 2', "Season 2"},
{'title=Hawaii Five-0 (2010 TV series) season 2', "Season 2"},
{'title=Doctor Who series 2', "Series 2"},
{'title=The X Factor (British TV series) series 2', "Series 2"},
{'title=Love Island (2015 TV series) series 2)', "Series 2"},
{'title=Big Brother Brasil 2', "Season 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 specials (2008–2010)', "2008–2010 specials"},
{'title=66th NHK Kōhaku Uta Gassen', ""},
})
end
function p:test_10_getListOfEpisodes()
self:preprocess_equals_sandbox_many('{{#invoke: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 TV series) season 2', "[[List of Top Gear (American TV series) episodes|List of episodes]]"},
{'title=Top Gear (American TV series) 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