Skip to content

test: add table-driven tests for rental redflags - #68

Merged
YASSERRMD merged 1 commit into
mainfrom
test/rental-redflags-tests
Jun 5, 2026
Merged

test: add table-driven tests for rental redflags#68
YASSERRMD merged 1 commit into
mainfrom
test/rental-redflags-tests

Conversation

@YASSERRMD

Copy link
Copy Markdown
Owner

Adds table-driven unit tests for internal/rental/redflags, which previously had no test file.

Coverage

  • TestScanIndividualRules — each rule fires in isolation (deposit wire/MoneyGram/gift-card, no-viewing, reverse-image, rent-below-market, urgency), asserting exactly one flag per isolated input and case-insensitive deposit matching.
  • TestScanBoundaries — pins exact thresholds (rent ratio at 0.5 vs 0.49, urgency at 2 vs 3, zero/empty/negative inputs) to catch off-by-one regressions.
  • TestScanSeverities — locks the severity (1–5) and non-empty message for every code.
  • TestScanCleanSubmission — a legitimate listing produces no flags.

Verification

  • gofmt clean
  • go build ./... passes
  • go test ./... passes
  • golangci-lint run — 0 issues

@YASSERRMD
YASSERRMD merged commit 61ae2a7 into main Jun 5, 2026
5 of 6 checks passed
@YASSERRMD
YASSERRMD deleted the test/rental-redflags-tests branch June 5, 2026 10:05
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.

1 participant