Module:PageLinks/testcases

From Wikipedia, the free encyclopedia
This is the current revision of this page, as edited by imported>Tamzin at 19:48, 21 November 2025 (update 11 years later). The present address (URL) is a permanent link to this version.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
local p = require('Module:UnitTests')

function p:test_basic()
    self:preprocess_equals('{{#invoke:PageLinks | main | t | page=Example }}', '<span>[[:Example|Example]]&nbsp;<span class="plainlinks lx">([[Talk:Example|talk]])</span></span>')
end

function p:test_category()
    self:preprocess_equals('{{#invoke:PageLinks | main | t | page=Category:Example }}', '<span>[[:Category:Example|Category:Example]]&nbsp;<span class="plainlinks lx">([[Category talk:Example|talk]])</span></span>')
end

function p:test_talk()
    self:preprocess_equals('{{#invoke:PageLinks | single | t | page=Example }}', '[[Talk:Example|talk]]')
end

function p:test_views()
    self:preprocess_equals('{{#invoke:PageLinks | single | vlm-sgs | page=Example }}', '[https://pageviews.toolforge.org/?start=2025-09-22&end=2025-11-21&project=en.wikipedia.org&pages=Example stats]')
end

function p:test_logs()
    self:preprocess_equals('{{#invoke:PageLinks | single | tl | page=Sylven Landesberg }}', '[//en.wikipedia.org/w/index.php?title=Special%3ALog&page=Sylven+Landesberg logs]')
end

return p