Jump to content

Module:TrainingPages/testcases

From Meta, a Wikimedia project coordination wiki
local p = require('Module:UnitTests')

function p:test_trainingpages()
    self:preprocess_equals_many('{{#invoke:TrainingPages|next_page|', '}}', {
        { 'index=Meta:Training/Index for testcases|page=Meta:Training/For students/valuable contribution', 'Meta:Training/For students/Editing topics' },
        { 'index=Meta:Training/Index for testcases|page=Meta:Training/For students/Editing topics', 'Meta:Training/For students/Getting started 1' },
        { 'index=Meta:Training/Index for testcases|page=Meta:Training/For students/Citing sources', 'Meta:Training/For students/Citing sources 2' },
        { 'index=Meta:Training/Index for testcases|page=Project:Training/For students/Citing sources', 'Meta:Training/For students/Citing sources 2' },
        { 'index=Meta:Training/Index for testcases|anonymize=yes|page=Meta:Training/For students/Citing sources', 'Project:Training/For students/Citing sources 2' },
    })
    self:preprocess_equals_many('{{#invoke:TrainingPages|last_page|', '}}', {
        { 'index=Meta:Training/Index for testcases|page=Meta:Training/For students/valuable contribution|defaultpage=Meta:Training/header', 'Meta:Training/header' },
        { 'index=Meta:Training/Index for testcases|page=Meta:Training/For students/Citing sources|defaultpage=Meta:Training/header', 'Meta:Training/For students/Text editing' },
        { 'Meta:Training/Index for testcases|page=Meta:Training/For students/Where to get help|defaultpage=Meta:Training/header', 'Meta:Training/For students/Discussion' }
    })
    self:preprocess_equals_many('{{#invoke:TrainingPages|main|', '}}', {
        { 'index=Meta:Training/Index for testcases|displacement=5|page=Meta:Training/For students/Citing sources|defaultpage=', 'Meta:Training/For students/Sandbox edits for new articles' },
        { 'index=Meta:Training/Index for testcases|displacement=5|page=Meta:Training/For students/Where to get help|defaultpage=', '' },
    })
    self:preprocess_equals_many('{{#invoke:TrainingPages|page_number|', '}}', {
        { 'index=Meta:Training/Nonexistent index|defaultpage=|noerr=yes', '' },
        { 'index=Meta:Training/Nonexistent index|defaultpage=', "[[Module:TrainingPages]] error (''index'' parameter):failed to access mw.title.new(Meta:Training/Nonexistent index):getContent() to load the index data" },
    })
    self:preprocess_equals_many('{{#invoke:TrainingPages|main|', '}}', {
        { 'index=Meta:Training/Index for testcases|page=1', 'Meta:Training/For students/valuable contribution' }
    })
    self:preprocess_equals_many('{{#invoke:TrainingPages|total_pages|', '}}', {
        { 'index=Meta:Training/Index for testcases ', '21' }
    })
end

return p