Skip to content

test: separates api integration tests into their own Jest project#2542

Merged
ygrishajev merged 2 commits intomainfrom
feat/tests
Feb 10, 2026
Merged

test: separates api integration tests into their own Jest project#2542
ygrishajev merged 2 commits intomainfrom
feat/tests

Conversation

@ygrishajev
Copy link
Contributor

@ygrishajev ygrishajev commented Jan 20, 2026

closes #2495

Summary by CodeRabbit

  • Tests
    • Extended test suite to include integration testing alongside unit and functional tests
    • Added new test scripts for integration, component testing, and coverage monitoring
    • Updated test infrastructure for improved coverage reporting

@ygrishajev ygrishajev requested a review from a team as a code owner January 20, 2026 15:02
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR creates a dedicated integration test project by updating npm test scripts to include the integration project alongside unit and functional tests, renaming test files with .integration suffix, and removing the functional test setup import from integration test files.

Changes

Cohort / File(s) Summary
Test Script Configuration
apps/api/package.json
Added new integration test scripts (test:component, test:integration, test:integration:cov, test:integration:watch) and updated existing test and test:cov commands to include --project=integration.
Integration Test Files
apps/api/src/billing/repositories/.../usage.repository.integration.ts, apps/api/src/provider/repositories/.../provider.repository.integration.ts, apps/api/src/provider/services/provider-dashboard/..., apps/api/src/provider/services/provider-regions/..., apps/api/src/provider/services/provider-versions/..., apps/api/src/transaction/repositories/.../transaction.repository.integration.ts, apps/api/src/user/services/user/...
Removed imports of @test/setup-functional-tests and reorganized remaining imports for consistency.
Test Type Declarations
apps/api/test/types/jest.d.ts
Removed Jest type declaration file containing custom matcher definitions (toBeTypeOrNull, dateTimeZ).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • #1805: Modifies the @test/setup-functional-tests module that is being removed from integration test files in this PR.
  • #2493: Updates the same provider service test files with shifted test organization and import adjustments.
  • #2163: Reorganizes test scoping by moving certificate and transaction tests into unit scope, similar to this PR's test project restructuring.

Suggested reviewers

  • baktun14

Poem

🐰 twitches nose excitedly
Integration tests hop to the side,
In their own project, with testing pride,
Setup imports cleared, imports reorganized,
Scripts updated, testing optimized! 🧪✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The removal of jest.d.ts declarations (toBeTypeOrNull, dateTimeZ matchers) appears unrelated to the stated objective of separating integration tests into a Jest project. Clarify whether removing Jest type definitions is intentional or should be reverted; this change falls outside the scope of organizing integration tests.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: separating API integration tests into their own Jest project, which aligns with the PR's primary objective.
Linked Issues check ✅ Passed The PR addresses all coding requirements from issue #2495: integration test npm scripts added, integration project added to test commands, import cleanup performed for integration test files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/tests

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

@ygrishajev ygrishajev force-pushed the feat/tests branch 2 times, most recently from 21d6f60 to a3400c7 Compare January 21, 2026 12:50
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/api/jest.config.js`:
- Line 19: Update the collectCoverageFrom array in jest config to exclude
integration test files; specifically add the pattern "!src/**/*.integration.ts"
to the existing collectCoverageFrom entry so files matching
src/**/*.integration.ts are not included in coverage collection (modify the
collectCoverageFrom array shown in the diff).
🧹 Nitpick comments (1)
apps/api/jest.config.js (1)

1-1: Remove the redundant maxWorkers override.

Line 20 already pins maxWorkers to 1, so the conditional at Lines 53–55 no longer changes behavior. If you still want a conditional override, restore a different default; otherwise, drop the block to reduce confusion.

🧹 No-op cleanup (keeps side effects of the config load)
-const { localConfig } = require("./test/services/local.config");
+require("./test/services/local.config");
@@
-if (localConfig.FUNDING_WALLET_MNEMONIC) {
-  config.maxWorkers = 1;
-}

Also applies to: 20-20, 53-55

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.84%. Comparing base (b794c3c) to head (5a0d5dd).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

❌ Your project status has failed because the head coverage (74.72%) is below the target coverage (78.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2542      +/-   ##
==========================================
- Coverage   51.85%   51.84%   -0.01%     
==========================================
  Files        1058     1058              
  Lines       28025    28025              
  Branches     6363     6344      -19     
==========================================
- Hits        14532    14530       -2     
- Misses      12993    13054      +61     
+ Partials      500      441      -59     
Flag Coverage Δ
api 74.72% <ø> (-0.03%) ⬇️
deploy-web 36.75% <ø> (ø)
log-collector 75.35% <ø> (ø)
notifications 87.94% <ø> (ø)
provider-console 81.48% <ø> (ø)
provider-proxy 84.35% <ø> (ø)
tx-signer 79.25% <ø> (ø)
see 43 files with indirect coverage changes
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/api/package.json`:
- Line 27: The current "test" script in package.json includes integration tests
which require a real DB; update the package.json scripts so "test" runs only
unit and functional tests (e.g., keep "jest --selectProjects unit functional"),
add a separate "test:integration" (and optionally "test:cov") script that runs
the integration suite (e.g., "jest --selectProjects integration"), or
alternatively modify "test" to conditionally boot a test DB when a specific env
var is present; make the change in the scripts section referencing the "test"
and new "test:integration" script names so local npm test remains fast and
integration runs are explicit.

@@ -361,6 +361,7 @@
"resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.0.0.tgz",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔄 Carefully review the package-lock.json diff

Resolve the comment if everything is ok

- node_modules/git-semver-tags/node_modules/conventional-commits-filter                    5.0.0   
- node_modules/git-semver-tags/node_modules/conventional-commits-parser                    6.2.1   
- node_modules/magicast                                                                    0.3.5   

@ygrishajev ygrishajev merged commit 0754bc7 into main Feb 10, 2026
53 of 54 checks passed
@ygrishajev ygrishajev deleted the feat/tests branch February 10, 2026 12:07
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.

console-api: create a separate jest project for service-db tests

2 participants