From b572c7d98e84f53706a36ab38dfaeaf935fda9c3 Mon Sep 17 00:00:00 2001 From: NovemLinguae <79697282+NovemLinguae@users.noreply.github.com> Date: Tue, 23 Apr 2024 01:09:26 -0700 Subject: [PATCH] add test for lifeStatus = dead (#341) to increase code coverage of a function I plan to refactor --- tests/test-core.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test-core.js b/tests/test-core.js index 232583a3..7d4a958e 100644 --- a/tests/test-core.js +++ b/tests/test-core.js @@ -239,6 +239,23 @@ describe( 'AFCH.addTalkPageBanners', function () { expect( output.countOfWikiProjectsRemoved ).toBe( 0 ); } ); + it( 'lifeStatus = dead', function () { + var talkText = ''; + var newAssessment = ''; + var revId = 592496; + var isBiography = true; + var newWikiProjects = []; + var lifeStatus = 'dead'; + var subjectName = ''; + var existingWikiProjects = []; + var alreadyHasWPBio = false; + var existingWPBioTemplateName = null; + var output = AFCH.addTalkPageBanners( talkText, newAssessment, revId, isBiography, newWikiProjects, lifeStatus, subjectName, existingWikiProjects, alreadyHasWPBio, existingWPBioTemplateName ); + expect( output.talkText ).toBe( '{{subst:WPAFC/article|class=|oldid=592496}}\n{{WikiProject Biography|living=no|class=|listas=}}\n\n' ); + expect( output.countOfWikiProjectsAdded ).toBe( 0 ); + expect( output.countOfWikiProjectsRemoved ).toBe( 0 ); + } ); + // FIXME: is supposed to remove the {{wikiproject biography}} template and report 1 template removed, but does not. code outside of AFCH.addTalkPageBanners() is incorrectly calculating alreadyHasWPBio as false // FIXME: 2 extra line breaks in the output it( 'talk page has {{wikiproject biography}}, and user selects that it\'s not a biography, so should remove {{wikiproject biography}}', function () {