Skip to content

Co-locate inert.go unit tests in inert_test.go; test escapeSlackTexts - #3

Merged
samkim merged 1 commit into
mainfrom
test/inert-test-colocation
Sep 28, 2026
Merged

samkim merged 1 commit into
mainfrom
test/inert-test-colocation

Conversation

@josephschorr

@josephschorr josephschorr commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

What

Follows the Go convention that a unit test for somefile.go lives in somefile_test.go. The direct unit tests of inert.go's Slack escaper/sweep helpers were scattered across three files named for other concerns; this moves them into a new inert_test.go, and adds the missing coverage for escapeSlackTexts.

Moved into inert_test.go (unchanged behavior)

  • TestEscapeSlackText, TestInertExcerptUsesTheSharedEscaper — from monitoring_test.go
  • TestInertExcerpt_Characterization — from content_inspection_characterization_test.go (file removed; renamed from TestContentInspectionInertExcerpt_Characterization to drop the now-misleading prefix)
  • TestCapInertRunesIsIdempotent, TestCapInertRunes_MeasuresParityOnTheTailRegionOnly — from inert_bare_link_sweep_test.go

The 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.go files — they test the surface, not inert.go in isolation. The shared test helpers (liveLinkIn, bareLureURL) stay where they are defined; same-package _test.go files share scope, so no helper churn was needed.

New: TestEscapeSlackTexts

escapeSlackTexts (the slice wrapper used by the join-notice participant/withheld lists) had no direct test. Added coverage for its three obligations:

  • the empty-input early return (both nil and a zero-length slice)
  • per-entry escaping
  • returns a new slice without mutating the caller's input

Verification

  • go test -race ./pkg/channels/channelkinds/slack/ — passes
  • gofmt -l and go vet — clean

Test-only reorg in a single package. The full integration/e2e ship gate was not run locally; worth confirming in CI before merge.

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.
@samkim
samkim merged commit 2035814 into main Sep 28, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants