Add unit tests for the tool functions of replace_tool and special page configuration - #60
Open
kanasimi wants to merge 1 commit into
Open
Add unit tests for the tool functions of replace_tool and special page configuration#60kanasimi wants to merge 1 commit into
kanasimi wants to merge 1 commit into
Conversation
…nfiguration Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The repo had no test infrastructure at all (no
testscript, no framework, no CI), so coverage was 0% for every file. Only two files arerequire()-able modules rather than one-shot bot scripts —replace/replace_tool.jsandspecial page configuration.js— so this adds anode:testsuite (no new dependencies) covering their pure tool functions: 41 tests, all offline.npm test→node --test test/,npm run test:coverage→ same with--experimental-test-coverage.test/helper.jsloadswiki loader.jsthe way the bot scripts do, and createswiki configuration.jsfrom the sample when missing, so tests run on a fresh clone without credentials.replace/replace_tool.js: exported the already-pure helpers (convert_special_move_to,unshift_move_configuration,normalize_page_title_token,remove_slash_tail,text_processor_for_search,text_processor_for_exturlusage) so they can be tested; no behavioral change to the exports used by task files..gitignorefornode_modules/,package-lock.jsonand the privatewiki configuration.js.One real bug found while testing
text_processor_for_exturlusage: the URL pattern was built from a normal string, so'\W'collapsed to the literalWand URLs were only replaced at the very start of the wikitext (i.e.see [http://old.example.com/page]was left untouched).Not covered (needs a live wiki session):
get_all_sections,main_move_process,parse_move_pairs_from_pageand the rest of the API-driven flow. Those would need an injectable session/HTTP mock to be testable.Link to Devin session: https://app.devin.ai/sessions/7b5c7d5e46cc4ce39db5e8d0cc5839a1
Requested by: @kanasimi