Jump to content

Module:Phabricator/testcases

From Wikipedia, the free encyclopedia
-- Unit tests for [[Module:Phabricator]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_01_no_params()
	self:preprocess_equals('{{#invoke:Phabricator|task}}', '[[phab:|Phabricator]]')
end

function p:test_02_task_id_param_only()
	self:preprocess_equals('{{#invoke:Phabricator|task|T1234}}', '[[Phabricator:T1234|T1234]]')
	self:preprocess_equals('{{#invoke:Phabricator|task|1234}}', '[[Phabricator:T1234|T1234]]')
end

function p:test_03_art_param()
	self:preprocess_equals('{{#invoke:Phabricator|task|art=y|T1234}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]]')
	self:preprocess_equals('{{#invoke:Phabricator|task|art=y|1234}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]]')
end

function p:test_04_article_param()
	self:preprocess_equals('{{#invoke:Phabricator|task|article=y|T1234}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]]')
	self:preprocess_equals('{{#invoke:Phabricator|task|article=y|1234}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]]')
end

function p:test_05_title_param()
	self:preprocess_equals('{{#invoke:Phabricator|task|T1234|Lorem ipsum dolor sit amet}}', '[[Phabricator:T1234|T1234]] • [[Phabricator:T1234|Lorem ipsum dolor sit amet]]')
	self:preprocess_equals('{{#invoke:Phabricator|task|1234|Lorem ipsum dolor sit amet}}', '[[Phabricator:T1234|T1234]] • [[Phabricator:T1234|Lorem ipsum dolor sit amet]]')
end

function p:test_06_art_param_and_title_param()
	self:preprocess_equals('{{#invoke:Phabricator|task|art=y|T1234|Lorem ipsum dolor sit amet}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]] • [[Phabricator:T1234|Lorem ipsum dolor sit amet]]')
	self:preprocess_equals('{{#invoke:Phabricator|task|art=y|1234|Lorem ipsum dolor sit amet}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]] • [[Phabricator:T1234|Lorem ipsum dolor sit amet]]')
end

function p:test_07_article_param_and_title_param()
	self:preprocess_equals('{{#invoke:Phabricator|task|article=y|T1234|Lorem ipsum dolor sit amet}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]] • [[Phabricator:T1234|Lorem ipsum dolor sit amet]]')
	self:preprocess_equals('{{#invoke:Phabricator|task|article=y|1234|Lorem ipsum dolor sit amet}}', '[[Wikipedia:Phabricator|Phabricator]]: [[Phabricator:T1234|T1234]] • [[Phabricator:T1234|Lorem ipsum dolor sit amet]]')
end

return p