Module:LDSverse/testcases: Difference between revisions

Content deleted Content added
Added test cases for Lectures on Faith
m Fixed typo
 
(8 intermediate revisions by the same user not shown)
Line 1:
-- Unit tests for [[Module:{{ROOTPAGENAME}}LDSVerse]]. Click talk page to run tests.
 
-- NB: If you ever see a failure on the results page even though the text seems like it's
-- *exactly* the same as what was expected but it still tells you there's a
-- difference, check the underscore situation. The LDSverse module does not use
-- underscores between words when generating the cross-wiki link (except for in
-- #bookmarks, where they are required for the bookmark to work) so if the
-- test case here expects there to be underscores in the generated link (e.g.,
-- [[s:Bible_(King_James)/Genesis|Gen.]]) it will throw an error because the
-- link generated by the module will just be [[s:Bible (King James)/Genesis|Gen.]].
-- This is really annoying to debug because by the time MediaWiki generates the
-- HTML that you see on the results page, it has in fact swapped in underscores
-- for those spaces! But that is what is going on. FYI :)
 
local p = require('Module:UnitTests')
 
Line 193 ⟶ 206:
 
-- BoM intro
function p:test_39_bom_introtest_39_bom_title_page()
self:preprocess_equals('{{LDS|IntroTitle Page to the Book of Mormon|introttlpg}}', '[[s:Book of Mormon (1981)/IntroductionTitle Page|IntroTitle Page to the Book of Mormon]]')
end
 
-- BoM 3 witnesses
function p:test_40_bom_3_witnesses()
self:preprocess_equals('{{LDS|3 Witnesses|three}}', '[[s:Book of Mormon (1981)/Introduction#The_Testimony_of_Three_WitnessesTestimony of Three Witnesses|3 Witnesses]]')
end
 
-- BoM 8 witnesses
function p:test_41_bom_8_witnesses()
self:preprocess_equals('{{LDS|8 Witnesses|eight}}', '[[s:Book of Mormon (1981)/Introduction#The_Testimony_of_Eight_WitnessesTestimony of Eight Witnesses|8 Witnesses]]')
end
 
Line 211 ⟶ 224:
self:preprocess_equals('{{LDS|Lectures re Faith|lof}}', '[[s:Lectures on Faith|Lectures re Faith]]')
end
 
-- Lectures on Faith
function p:test_43_Lecture_Seventh()
self:preprocess_equals('{{LDS|Lectures about Faith|lof|7}}', '[[s:Lectures on Faith/Lecture_SeventhLecture Seventh|Lectures about Faith 7]]')
end
 
-- Forgotten second parameter
-- It's easy to forget to "repeat" the second parameter for the book name, especially if you use
-- the full book name as the display text, so these next tests check for a fix for that
function p:test_44_forgotten_2nd_param_1()
self:preprocess_equals('{{LDS|Alma|7}}', '[[s:Book of Mormon (1981)/Alma#chapter_7|Alma 7]]')
end
 
-- Forgotten second parameter
function p:test_45_forgotten_2nd_param_2()
self:preprocess_equals('{{LDS|Alma|7|11}}', '[[s:Book of Mormon (1981)/Alma#7:11|Alma 7:11]]')
end
 
-- Forgotten second parameter
function p:test_46_forgotten_2nd_param_3()
self:preprocess_equals('{{LDS|Alma|7|11|–13, 23–24|||x}}', '[[s:Book of Mormon (1981)/Alma#7:11|Alma 7:11–13, 23–24]]')
end
 
-- Forgotten second parameter and abbreviation in displayText
function p:test_47_forgotten_2nd_param_4()
self:preprocess_equals('{{LDS|2 Ne.|4|28|30}}', '[[s:Book of Mormon (1981)/2 Nephi#4:28|2 Ne. 4:28–30]]')
end
 
-- Graceful error handling for bad LoF numbers
function p:test_48_bad_lof_param()
self:preprocess_equals('{{LDS|Lectures about Faith|lof|8}}', '[[s:Lectures on Faith|Lectures about Faith 8 (invalid)]]')
end