Skip to content

test: simplify alias and arg-parsing tests covered by property tests#182

Merged
BYK merged 1 commit intomainfrom
test/simplify-redundant-tests
Feb 5, 2026
Merged

test: simplify alias and arg-parsing tests covered by property tests#182
BYK merged 1 commit intomainfrom
test/simplify-redundant-tests

Conversation

@BYK
Copy link
Member

@BYK BYK commented Feb 5, 2026

Summary

Remove example-based tests that are now redundant with property-based tests, reducing test maintenance burden while maintaining coverage.

Changes

test/lib/alias.test.ts (313 → 132 lines, -181 lines)

  • Removed: findCommonWordPrefix tests (8 tests) - all invariants covered by property tests
  • Removed: findShortestUniquePrefixes tests (6 tests) - all invariants covered by property tests
  • Kept: Integration tests showing real workflows
  • Kept: buildOrgAwareAliases tests with specific expected outputs

test/lib/arg-parsing.test.ts (244 → 109 lines, -135 lines)

  • Removed: Happy-path type determination tests (~20 tests) - covered by property tests
  • Kept: Error message verification tests (6 tests)
  • Kept: Edge case documentation tests (3 tests)
  • Kept: Representative examples for documentation

Results

  • Lines removed: 295
  • Tests removed: 49 (998 → 949)
  • Coverage: Maintained via property tests in *.property.test.ts files

Verification

All tests pass:

949 pass, 0 fail, 17077 expect() calls

Remove example-based tests that are redundant with property-based tests:

- alias.test.ts: Remove findCommonWordPrefix and findShortestUniquePrefixes
  tests (covered by property tests), keep integration tests and specific
  output verification tests
- arg-parsing.test.ts: Remove happy-path type determination tests (covered
  by property tests), keep error message verification and edge cases

Reduction: 295 lines removed, 49 fewer tests
Total coverage maintained via property tests
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (dsn) Add project root detection for automatic DSN discovery by BYK in #159
  • (issue) Replace --org/--project flags with /ID syntax by BYK in #161
  • (lib) Add anyTrue helper for parallel-with-early-exit pattern by BYK in #174
  • (telemetry) Add withTracing helper to reduce Sentry span boilerplate by BYK in #172

Bug Fixes 🐛

  • (types) Align schema types with Sentry API by betegon in #169
  • ParseIssueArg now checks slashes before dashes by BYK in #177
  • Address bugbot review comments on dsn-cache model-based tests by BYK in #176
  • Added nullable in substatus's zod validation by MathurAditya724 in #157

Internal Changes 🔧

  • (upgrade) Use centralized user-agent for GitHub API requests by BYK in #173

Other

  • test: simplify alias and arg-parsing tests covered by property tests by BYK in #182
  • test: add property tests for API command and human formatters by BYK in #181
  • test: remove redundant DB tests covered by model-based tests by BYK in #180
  • test: add property tests for async utilities (Phase 4) by BYK in #179
  • test: add model-based tests for DSN and project cache by BYK in #171
  • test: add model-based and property-based testing with fast-check by BYK in #166

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Codecov Results 📊

✅ Patch coverage is 100.00%. Project has 2175 uncovered lines.
✅ Project coverage is 70.81%. Comparing base (base) to head (head).

Files with missing lines (33)
File Patch % Lines
human.ts 31.80% ⚠️ 684 Missing
resolve-target.ts 10.74% ⚠️ 291 Missing
oauth.ts 25.10% ⚠️ 194 Missing
upgrade.ts 40.23% ⚠️ 153 Missing
api-client.ts 74.21% ⚠️ 138 Missing
resolver.ts 3.23% ⚠️ 120 Missing
errors.ts 5.94% ⚠️ 95 Missing
migration.ts 47.44% ⚠️ 82 Missing
version-check.ts 34.04% ⚠️ 62 Missing
telemetry.ts 77.43% ⚠️ 51 Missing
api.ts 89.80% ⚠️ 47 Missing
seer.ts 75.54% ⚠️ 45 Missing
preload.ts 38.71% ⚠️ 38 Missing
seer.ts 79.87% ⚠️ 30 Missing
schema.ts 52.73% ⚠️ 26 Missing
utils.ts 87.43% ⚠️ 24 Missing
detector.ts 90.10% ⚠️ 20 Missing
code-scanner.ts 95.00% ⚠️ 16 Missing
fs-utils.ts 57.14% ⚠️ 9 Missing
auth.ts 94.78% ⚠️ 7 Missing
dsn-cache.ts 96.71% ⚠️ 7 Missing
project-root.ts 97.73% ⚠️ 7 Missing
feedback.ts 84.21% ⚠️ 6 Missing
upgrade.ts 93.83% ⚠️ 5 Missing
colors.ts 91.84% ⚠️ 4 Missing
env-file.ts 97.58% ⚠️ 3 Missing
sentry-urls.ts 88.00% ⚠️ 3 Missing
project-aliases.ts 97.40% ⚠️ 2 Missing
project-root-cache.ts 96.92% ⚠️ 2 Missing
alias.ts 99.28% ⚠️ 1 Missing
parser.ts 98.63% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
helpers.ts 94.74% ⚠️ 1 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    70.81%    70.81%        —%
==========================================
  Files           55        55         —
  Lines         7451      7451         —
  Branches         0         0         —
==========================================
+ Hits          5276      5276         —
- Misses        2175      2175         —
- Partials         0         0         —

Generated by Codecov Action

@BYK BYK merged commit d743e03 into main Feb 5, 2026
24 checks passed
@BYK BYK deleted the test/simplify-redundant-tests branch February 5, 2026 02:13
BYK added a commit that referenced this pull request Feb 5, 2026
## Summary

Remove example-based tests that are now redundant with property-based
tests in `issue-id.property.test.ts`.

## Changes

### `test/lib/issue-id.test.ts` (230 → 144 lines, -86 lines)

**Removed** (covered by property tests):
- `isNumericId` tests (4 tests)
- `isShortSuffix` tests (5 tests)
- `isShortId` tests (4 tests)
- `expandToFullShortId` verbose examples (1 test)

**Kept**:
- `parseAliasSuffix` edge case tests (7 tests) - specific parsing
behaviors
- `expandToFullShortId` representative examples (2 tests)
- Integration flow tests (6 tests) - valuable workflow documentation

## Results

- **Lines removed**: 86
- **Tests removed**: 14 (949 → 935)
- **Coverage**: Maintained via property tests

## Verification

All tests pass:
```
935 pass, 0 fail, 17059 expect() calls
```

---

This is Phase 2 of the test simplification effort. Phase 1 was merged in
#182.
BYK added a commit that referenced this pull request Feb 5, 2026
## Summary

Add property-based tests for URL validation and building functions in
`src/lib/sentry-urls.ts`. This is Phase 3 of the test improvement
effort.

## New Tests

### `test/lib/sentry-urls.property.test.ts` (417 lines, 27 tests)

**`isSentrySaasUrl` properties:**
- `sentry.io` always returns true
- `*.sentry.io` subdomains always return true  
- Non-sentry.io domains return false
- Invalid URLs return false
- Security: lookalike domains return false
- Deterministic behavior

**URL building functions:**
- `buildOrgUrl` - output pattern, contains slug, valid URL
- `buildProjectUrl` - contains both slugs, valid URL
- `buildEventSearchUrl` - event ID in query string
- `buildOrgSettingsUrl` - with/without hash fragment
- `buildSeerSettingsUrl` - contains /seer/ path
- `buildBillingUrl` - with/without product query param

**Cross-function properties:**
- All URL builders produce valid URLs
- All URL builders are deterministic

## Results

- **New tests**: 27
- **New assertions**: ~1,800
- **Total tests**: 970 (935 → 970)

## Verification

All tests pass:
```
970 pass, 0 fail, 20318 expect() calls
```

---

## Test Improvement Summary (All Phases)

| Phase | PR | Description | Lines Changed | Tests Changed |
|-------|-----|-------------|---------------|---------------|
| 1 | #182 ✅ | Simplify alias & arg-parsing tests | -295 | -49 |
| 2 | #183 ✅ | Simplify issue-id tests | -86 | -14 |
| 3 | #184 🔄 | Add sentry-urls property tests | +417 | +27 |

**Net result**: Better test coverage with more robust property-based
testing.
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