-- 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', '#F8F9FA'},
		{'Aaaaaaaaaaa|shortname', 'Aaaaaaaaaaa'},
		{'aontú|color', '#F8F9FA'},
    }, {nowiki=1})
end

function p:test_02_fallback_values()
	self:preprocess_equals_sandbox_many('{{#invoke:Political party', 'fetch', {
		{'A test no values|color', '<strong class="error">Value not in template. Please request that it be added.</strong>'},
		{'Unitary Socialist Party (Italy, 1922)|shortname', 'Unitary Socialist Party'},
		{'[[Unitary Socialist Party (Italy, 1922)]]|shortname', 'Unitary Socialist Party'},
		{'[[Unitary Socialist Party (Italy, 1922)|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', {
		{'', '<strong class="error">parameter 1 should be a party name.</strong>'},
		{'|color', '<strong class="error">parameter 1 should be a party name.</strong>'},
		{'|shortname', '<strong class="error">parameter 1 should be a party name.</strong>'},
		{'|abbrev', '<strong class="error">parameter 1 should be a party name.</strong>'},
		{'Business and Professional Group', '<strong class="error">parameter 2 should be the output type.</strong>'},
    }, {nowiki=1})
end

return p
"https://si.wikipedia.org/w/index.php?title=Module:Political_party/testcases&oldid=669204" වෙතින් සම්ප්‍රවේශනය කෙරිණි