Repository navigation
Co-locate inert.go unit tests in inert_test.go; test escapeSlackTexts - #3
Merged
Merged
Conversation
Move the direct unit tests of inert.go's escaper/sweep helpers into a new inert_test.go, matching the Go convention that a unit test for somefile.go lives in somefile_test.go: - TestEscapeSlackText, TestInertExcerptUsesTheSharedEscaper (from monitoring_test.go) - TestInertExcerpt_Characterization (from content_inspection_characterization_test.go, now removed) - TestCapInertRunesIsIdempotent, TestCapInertRunes_MeasuresParityOnTheTailRegionOnly (from inert_bare_link_sweep_test.go) The behavioral tests that drive these helpers through a render surface stay with their surface (the *_inertness_test.go / *_inert_test.go files); they test the surface, not inert.go in isolation. Add TestEscapeSlackTexts covering the slice wrapper's previously-untested contract: the empty-input early return, per-entry escaping, and that it returns a new slice without mutating the caller's input.
josephschorr
force-pushed
the
test/inert-test-colocation
branch
from
September 26, 2026 05:18
591b88d to
ba128f4
Compare
samkim
approved these changes
Sep 28, 2026
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.
What
Follows the Go convention that a unit test for
somefile.golives insomefile_test.go. The direct unit tests ofinert.go's Slack escaper/sweep helpers were scattered across three files named for other concerns; this moves them into a newinert_test.go, and adds the missing coverage forescapeSlackTexts.Moved into
inert_test.go(unchanged behavior)TestEscapeSlackText,TestInertExcerptUsesTheSharedEscaper— frommonitoring_test.goTestInertExcerpt_Characterization— fromcontent_inspection_characterization_test.go(file removed; renamed fromTestContentInspectionInertExcerpt_Characterizationto drop the now-misleading prefix)TestCapInertRunesIsIdempotent,TestCapInertRunes_MeasuresParityOnTheTailRegionOnly— frominert_bare_link_sweep_test.goThe behavioral tests that drive these helpers through a render surface (
buildAppHomeView,renderInteractionDetailsModal, the metaagent/join-notice paths) stay with their surface in the*_inertness_test.go/*_inert_test.gofiles — they test the surface, notinert.goin isolation. The shared test helpers (liveLinkIn,bareLureURL) stay where they are defined; same-package_test.gofiles share scope, so no helper churn was needed.New:
TestEscapeSlackTextsescapeSlackTexts(the slice wrapper used by the join-notice participant/withheld lists) had no direct test. Added coverage for its three obligations:niland a zero-length slice)Verification
go test -race ./pkg/channels/channelkinds/slack/— passesgofmt -landgo vet— cleanTest-only reorg in a single package. The full integration/e2e ship gate was not run locally; worth confirming in CI before merge.