Module:Formatted appearance/testcases

From OODA WIKI

Documentation for this module may be created at Module:Formatted appearance/testcases/doc

-- Unit tests for [[Module:Formatted appearance]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_generic()
	self:preprocess_equals_many('{{#invoke:Formatted appearance|getFormattedAppearance|', '}}', {
		{'major_work=Arrow', '\'\'Arrow\'\''},
		{'minor_work=Pilot', '"Pilot"'},
		{'date=October 10, 2012', 'October 10, 2012'},
		{'major_work=Arrow|minor_work=Pilot', '{{unbulleted list|\"Pilot\"|\'\'Arrow\'\'}}'},
		{'major_work=Arrow|date=October 10, 2012', '{{unbulleted list|\'\'Arrow\'\'|October 10, 2012}}'},
		{'minor_work=Pilot|date=October 10, 2012', '{{unbulleted list|"Pilot"|October 10, 2012}}'},
		{'major_work=Arrow|minor_work=Pilot|date=October 10, 2012', '{{unbulleted list|"Pilot"|\'\'Arrow\'\'|October 10, 2012}}'},
		{'major_work=[[Arrow (TV series)|Arrow]]|minor_work=[[Pilot (Arrow)|Pilot]]|date={{start date|2012|10|10}}', '{{unbulleted list|"[[Pilot (Arrow)|Pilot]]"|\'\'[[Arrow (TV series)|Arrow]]\'\'|{{start date|2012|10|10}}}}'},
    })
 end
 
function p:test_comic()
	self:preprocess_equals_many('{{#invoke:Formatted appearance|getFormattedAppearance|', '}}', {
		{'major_work=The Incredible Hulk', '\'\'The Incredible Hulk\'\''},
		{'issue=180', ''},
		{'issue=#180', ''},
		{'date=October, 1974', 'October, 1974'},
		{'major_work=The Incredible Hulk|issue=180', '\'\'The Incredible Hulk\'\' #180'},
		{'major_work=The Incredible Hulk|date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\'|October, 1974}}'},
		{'issue=180|date=October, 1974', 'October, 1974'},
		{'major_work=The Incredible Hulk|issue=180|_date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' #180|October, 1974}}'},
		{'major_work=The Incredible Hulk|issue=Issue 180|date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' Hulk Issue #180|October, 1974}}'},
		{'major_work=The Incredible Hulk|issue=Issue #180|date=October, 1974', '{{unbulleted list|\'\'The Incredible Hulk\'\' Issue #180|October, 1974}}'},
		{'major_work=[[The Incredible Hulk (comic book)|The Incredible Hulk]]|issue=180|date={{start date|1974|10}}', '{{unbulleted list|\'\'[[The Incredible Hulk (comic book)|The Incredible Hulk]]\'\' #180|{{start date|1974|10}}}}'},
    })
end

return p