-- Example Unit tests for [[Module:Professional wrestling]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_profiles_blank()
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles}}', '[[Category:Professional wrestling profiles template without any identifiers]]');
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena}}', '[[Category:Professional wrestling profiles template without any identifiers]]');
end
function p:test_profiles_single()
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|cagematch = 691}}', "Professional wrestling profiles/testcases's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|cagematch = 691}}', "John Cena's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|wrestlingdata = 336}}', "Professional wrestling profiles/testcases's profile at [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|wrestlingdata = 336}}', "John Cena's profile at [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|iwd = john-cena-350}}', "Professional wrestling profiles/testcases's profile at [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|iwd = john-cena-350}}', "John Cena's profile at [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
end
function p:test_profiles_double()
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|cagematch = 691|wrestlingdata = 336}}', "Professional wrestling profiles/testcases's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net], [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|cagematch = 691|wrestlingdata = 336}}', "John Cena's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net], [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|cagematch = 691|iwd =john-cena-350}}', "Professional wrestling profiles/testcases's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net], [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|cagematch = 691|iwd =john-cena-350}}', "John Cena's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net], [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|wrestlingdata = 336|iwd =john-cena-350}}', "Professional wrestling profiles/testcases's profile at [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com], [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|wrestlingdata = 336|iwd =john-cena-350}}', "John Cena's profile at [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com], [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
end
function p:test_profiles_triple()
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|cagematch = 691|wrestlingdata = 336|iwd =john-cena-350}}', "Professional wrestling profiles/testcases's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net], [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com], [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| profiles|name = John Cena|cagematch = 691|wrestlingdata = 336|iwd =john-cena-350}}', "John Cena's profile at [https://www.cagematch.net/?id=2&nr=691 Cagematch.net], [http://wrestlingdata.com/index.php?befehl=bios&wrestler=336 Wrestlingdata.com], [http://www.profightdb.com/wrestlers/john-cena-350.html Internet Wrestling Database]");
end
function p:test_wrestling_titles()
self:preprocess_equals('{{#invoke:Professional wrestling profiles| wrestlingtitlespersonalities|id = zbyszko_stanislaus|name = Stanislaus Zbyszko}}', "[http://www.wrestling-titles.com/personalities/zbyszko_stanislaus/ Stanislaus Zbyszko]'s profile at Wrestling-Titles.com");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| wrestlingtitlespersonalities|id = zbyszko_stanislaus}}', "[http://www.wrestling-titles.com/personalities/zbyszko_stanislaus/ Professional wrestling profiles/testcases]'s profile at Wrestling-Titles.com");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| wrestlingtitlespersonalities|zbyszko_stanislaus| Stanislaus Zbyszko}}', "[http://www.wrestling-titles.com/personalities/zbyszko_stanislaus/ Stanislaus Zbyszko]'s profile at Wrestling-Titles.com");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| wrestlingtitlespersonalities|zbyszko_stanislaus}}', "[http://www.wrestling-titles.com/personalities/zbyszko_stanislaus/ Professional wrestling profiles/testcases]'s profile at Wrestling-Titles.com");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| wrestlingtitlespersonalities|}}', "[[Category:Wrestling Titles template with no id set]]");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| wrestlingtitlespersonalities| name = test}}', "[[Category:Wrestling Titles template with no id set]]");
end
function p:test_cage_match()
self:preprocess_equals('{{#invoke:Professional wrestling profiles| cagematch|id = 691|name = John Cena}}', "[https://www.cagematch.net/?id=2&nr=691 John Cena]'s profile at Cagematch.net");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| cagematch|id = 691}}', "[https://www.cagematch.net/?id=2&nr=691 Professional wrestling profiles/testcases]'s profile at Cagematch.net");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| cagematch|691| John Cena}}', "[https://www.cagematch.net/?id=2&nr=691 John Cena]'s profile at Cagematch.net");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| cagematch|691}}', "[https://www.cagematch.net/?id=2&nr=691 Professional wrestling profiles/testcases]'s profile at Cagematch.net");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| cagematch|}}', "");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| cagematch| name = John Cena}}', "");
end
function p:test_rohroster()
local url = "http://www.rohwrestling.com/wrestlers/matt-sydal";
self:preprocess_equals('{{#invoke:Professional wrestling profiles| rohroster|id = matt-sydal|name = Matt Sydal}}', "[" .. url .. " Matt Sydal]'s [[Ring of Honor]] profile");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| rohroster|id = matt-sydal}}', "[" .. url .. " Professional wrestling profiles/testcases]'s [[Ring of Honor]] profile");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| rohroster|matt-sydal| Matt Sydal}}', "[" .. url .. " Matt Sydal]'s [[Ring of Honor]] profile");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| rohroster|matt-sydal}}', "[" .. url .. " Professional wrestling profiles/testcases]'s [[Ring of Honor]] profile");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| rohroster|}}', "");
self:preprocess_equals('{{#invoke:Professional wrestling profiles| rohroster| name = Matt Sydal}}', "");
end
function p:test_njpw()
local linkformat = "[%s %s]'s [[New Japan Pro-Wrestling]] profile";
local url = "http://www.njpw.co.jp/english/data/detail_profile.php?f=932";
local names = {"Matt Sydal", "Professional wrestling profiles/testcases"};
local values = {string.format(linkformat, url, names[1]), string.format(linkformat, url, names[2])};
local template = "njpw"; local id = "932";
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id =' .. id .. '|name = ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '| ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id = ' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|}}', "");
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '| name = ' .. names[1] .. '}}', "");
end
function p:test_gfw()
local linkformat = "[%s %s]'s [[Global Force Wrestling]] profile";
local url = "http://globalforcewrestling.com/roster/scottsteiner/";
local names = {"Scott Steiner", "Professional wrestling profiles/testcases"};
local values = {string.format(linkformat, url, names[1]), string.format(linkformat, url, names[2])};
local template = "gfw"; local id = "scottsteiner";
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id =' .. id .. '|name = ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '| ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id = ' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|}}', "");
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '| name = ' .. names[1] .. '}}', "");
end
function p:test_dgusa()
local linkformat = "[%s %s] at the official [[Dragon Gate USA]] website";
local url = "http://dgusa.tv/bio/homicide";
local names = {"Homicide", "Professional wrestling profiles/testcases"};
local values = {string.format(linkformat, url, names[1]), string.format(linkformat, url, names[2])};
local template = "dragongateusa"; local id = "homicide";
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id =' .. id .. '|name = ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '| ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id = ' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|}}', "");
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '| name = ' .. names[1] .. '}}', "");
end
function p:test_chikara()
local linkformat = "[%s %s] at the official [[Chikara_(professional_wrestling)|Chikara]] website";
local url = "http://chikarapro.com/chikara-roster/homicide";
local names = {"Homicide", "Professional wrestling profiles/testcases"};
local values = {string.format(linkformat, url, names[1]), string.format(linkformat, url, names[2])};
local template = "chikara"; local id = "homicide";
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id =' .. id .. '|name = ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '| ' .. names[1] .. '}}', values[1]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|id = ' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|' .. id .. '}}', values[2]);
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '|}}', "");
self:preprocess_equals('{{#invoke:Professional wrestling profiles|' .. template .. '| name = ' .. names[1] .. '}}', "");
end
return p