Module:Political party/testcases

-- Unit tests for Module:Political party. Click talk page to run tests. local p = require('Module:UnitTests')

function p:test_01_bad_values self:preprocess_equals_sandbox_many('{{#invoke:Political party', 'fetch', {		{'Aaaaaaaaaaa|color', '&#35;F8F9FA'},		{'Aaaaaaaaaaa|shortname', 'Aaaaaaaaaaa'},		{'aontú|color', '&#35;F8F9FA'},   }, {nowiki=1}) end

function p:test_02_fallback_values self:preprocess_equals_sandbox_many('{{#invoke:Political party', 'fetch', {		{'A test no values|color', ' Value not in template. Please request that it be added. '},		{'Unitary Socialist Party (Italy, 1922)|shortname', 'Unitary Socialist Party'},		{'Unitary Socialist Party (Italy, 1922)|shortname', 'Unitary Socialist Party'},		{'Unitary Socialist Party Italy, 1922|shortname', 'Unitary Socialist Party'},		{'Actual Equality|shortname', 'Actual Equality'},		{'Actual Equality|abbrev', 'Actual Equality'},   }, {nowiki=1}) end

function p:test_03_invalid_types self:preprocess_equals_sandbox_many('{{#invoke:Political party', 'fetch', {		{'', ' parameter 1 should be a party name. '},		{'|color', ' parameter 1 should be a party name. '},		{'|shortname', ' parameter 1 should be a party name. '},		{'|abbrev', ' parameter 1 should be a party name. '},		{'Business and Professional Group', ' parameter 2 should be the output type. '},   }, {nowiki=1}) end

return p