Module:EUPP seats/testcases composition bar
Appearance
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_main()
-- composition bar
-- testing output for one party
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|EP|ALDE}}', '{{Composition bar|49|720|hex=#FFD700}}')
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|upper-house|ALDE}}', '{{Composition bar|103|1457|hex=#FFD700}}')
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|ms-upper-house|ALDE}}', '{{Composition bar|103|1457|hex=#FFD700}}')
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|lower-house|EGP}}', '{{Composition bar|260|6318|hex=#57B45F}}')
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|lower-house|Volt}}', '{{Composition bar|3|6318|hex=#502379}}')
-- testing output for all parties
--self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|lower|all}}', '{{Composition bar|3938|6318|hex=#BBBBBB}}')
-- test other parameters
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|upper-house|EFA|width=80%|percent=yes}}', '{{Composition bar|16|1457|hex=#671B88|width=80%|per=1}}')
-- testing error messages
-- composition_bar
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|lower-house|test}}', 'Error: EUPP composition bar: unknown party: TEST (help)')
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|test|ALDE}}', 'Error: EUPP composition bar: unknown institution: TEST (help)')
self:preprocess_equals_preprocess('{{#invoke:EUPP seats|composition_bar|lower-house|thisparty}}', 'Error: EUPP composition bar: not called from the page of a European party (help)')
end
return p