Koha Test Wiki MW Canasta on Koha Portainer
Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.
For the current Koha Wiki, visit https://wiki.koha-community.org .Module:Page/testcases
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Page/testcases/doc
-- Unit tests for [[Module:Page]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_main()
self:preprocess_equals('{{#invoke:Page|id}}', '38871376')
self:preprocess_equals('{{#invoke:Page|id|}}', '38871376')
self:preprocess_equals('{{#invoke:Page|id|WP:AFC}}', '3376456')
self:preprocess_equals_preprocess('{{#invoke:Page|id|[}}', '{{Error|Error: mw.title.new("[", "") failed}}')
self:preprocess_equals('{{#invoke:Page|id|makeTitle=yes|namespace=WP|AFC}}', '3376456')
self:preprocess_equals_preprocess('{{#invoke:Page|id|makeTitle=yes|namespace=Nonsense|AFC}}', "{{Error|Error: bad argument #1 to 'makeTitle' (unrecognized namespace name 'Nonsense')}}")
self:preprocess_equals('{{#invoke:Page|prefixedText|id=3376456}}', 'Wikipedia:AFC')
self:preprocess_equals_preprocess('{{#invoke:Page|inNamespace|p1=Nonsense|WP:AFC}}', "{{Error|Error: bad argument #1 to 'inNamespace' (unrecognized namespace name 'Nonsense')}}")
self:preprocess_equals('{{#invoke:Page|interwiki|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|namespace|WP:AFC}}', '4')
self:preprocess_equals('{{#invoke:Page|fragment|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|nsText|WP:AFC}}', 'Wikipedia')
self:preprocess_equals('{{#invoke:Page|subjectNsText|WP:AFC}}', 'Wikipedia')
self:preprocess_equals('{{#invoke:Page|text|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|prefixedText|WP:AFC}}', 'Wikipedia:AFC')
self:preprocess_equals('{{#invoke:Page|fullText|WP:AFC}}', 'Wikipedia:AFC')
self:preprocess_equals('{{#invoke:Page|rootText|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|baseText|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|subpageText|WP:AFC}}', 'AFC')
self:preprocess_equals('{{#invoke:Page|canTalk|WP:AFC}}', 'true')
self:preprocess_equals('{{#invoke:Page|exists|WP:AFC}}', 'true')
self:preprocess_equals('{{#invoke:Page|fileExists|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|isContentPage|WP:AFC}}', '')
self:preprocess_equals('{{#invoke:Page|nsText|id=3376456}}', 'Wikipedia')
self:preprocess_equals('{{#invoke:Page|getContent|WP:AFC}}', '<pre>#REDIRECT [[Wikipedia:Articles for creation]]\n\n{{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}</pre>')
self:preprocess_equals('{{#invoke:Page|getContent|WP:AFC|as=pre}}', '<pre>#REDIRECT [[Wikipedia:Articles for creation]]\n\n{{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}</pre>')
self:preprocess_equals('{{#invoke:Page|getContent|WP:AFC|as=nowiki}}', '#REDIRECT [[Wikipedia:Articles for creation]]\n {{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}')
self:preprocess_equals_preprocess('{{#invoke:Page|getContent|WP:AFC|as=expand}}', '\n#REDIRECT [[Wikipedia:Articles for creation]]\n\n{{Redirect category shell|\n{{R to Wikipedia namespace}}\n{{R from shortcut}}\n}}')
end
return p