Skip to content

Commit

Permalink
add test. mark it as skipped since it's failing
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Aug 22, 2024
1 parent c22102f commit b720518
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,63 @@ I have a question. Can you help answer it? –[[User:Novem Linguae|<span style="
expect( output.bannerCount ).toBe( 1 );
} );

it( 'talk page has existing templates, WikiProject banners on top', function () {
var talkText =
`{{WikiProject Women}}
{{translated page|ar|بحيرة كناو|version=|small=no|insertversion=|section=}}
`;
var newAssessment = '';
var revId = 592485;
var isBiography = false;
var newWikiProjects = [];
var lifeStatus = 'unknown';
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(
`{{WikiProject banner shell|
{{subst:WPAFC/article|oldid=592485}}
{{WikiProject Women}}
}}
{{translated page|ar|بحيرة كناو|version=|small=no|insertversion=|section=}}
`
);
expect( output.countOfWikiProjectsAdded ).toBe( 0 );
expect( output.countOfWikiProjectsRemoved ).toBe( 0 );
expect( output.bannerCount ).toBe( 2 );
} );

// FIXME: we probably need to write code that cuts every existing WikiProject banner template and pastes it at the top of the page
it.skip( 'talk page has existing templates, WikiProject banners on bottom', function () {
var talkText =
`{{translated page|ar|بحيرة كناو|version=|small=no|insertversion=|section=}}
{{WikiProject Women}}
`;
var newAssessment = '';
var revId = 592485;
var isBiography = false;
var newWikiProjects = [];
var lifeStatus = 'unknown';
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(
`{{WikiProject banner shell|
{{subst:WPAFC/article|oldid=592485}}
{{WikiProject Women}}
}}
{{translated page|ar|بحيرة كناو|version=|small=no|insertversion=|section=}}
`
);
expect( output.countOfWikiProjectsAdded ).toBe( 0 );
expect( output.countOfWikiProjectsRemoved ).toBe( 0 );
expect( output.bannerCount ).toBe( 2 );
} );

// FIXME: unexpected \n between new banners and old banners. https://github.com/wikimedia-gadgets/afc-helper/issues/330
it( 'talk page has existing WikiProject banners', function () {
var talkText =
Expand Down

0 comments on commit b720518

Please sign in to comment.