Skip to content

feat(tests): add jest test runner and unit test coverage for studio services - #1375

Open
SH20RAJ wants to merge 1 commit into
asyncapi:masterfrom
SH20RAJ:feat/service-unit-tests
Open

SH20RAJ wants to merge 1 commit into
asyncapi:masterfrom
SH20RAJ:feat/service-unit-tests

Conversation

@SH20RAJ

@SH20RAJ SH20RAJ commented Sep 2, 2026

Copy link
Copy Markdown

Description

This PR addresses issue #1246 by configuring the Jest testing infrastructure for apps/studio and adding unit test coverage for services that previously lacked tests.

Changes Included:

  1. Jest Testing Setup for apps/studio:

    • Configured jest.config.js and jest.setup.js with Next.js integration and standard polyfills (TextEncoder, TextDecoder).
    • Added lightweight test mocks for Monaco Editor, Monaco YAML, AsyncAPI React component, JSONPath, and asset loaders.
    • Added "test": "jest" and "test:watch": "jest --watch" scripts to apps/studio/package.json enabling monorepo test execution via Turborepo (pnpm test).
  2. New Service Unit Tests Added:

    • SettingsService (settings.service.test.ts): Unit tests covering .get(), .set(), and .isEqual().
    • SpecificationService (specification.service.test.ts): Unit tests covering .specs, .latestVersion, and .getSpec().
    • ServerAPIService (server-api.service.test.ts): Unit tests covering .retrieveProblem() (200, 400, 500 status codes) and .generate().
  3. State Isolation in Existing Test Suites:

    • Fixed file state isolation in navigation.service.test.ts during non-URL source transitions.

Verification:

  • pnpm test: All 7 test suites passed (37/37 tests).
  • pnpm lint: 0 errors / 0 warnings.
  • pnpm build: 4/4 packages and apps built successfully.

Fixes #1246

…ervices

This PR introduces Jest testing infrastructure for apps/studio and adds comprehensive unit test coverage for services:
- Configured Jest runner with Next.js integration and standard mocks
- Added unit tests for SettingsService (covering get, set, isEqual)
- Added unit tests for SpecificationService (covering specs, latestVersion, getSpec)
- Added unit tests for ServerAPIService (covering retrieveProblem, generate)
- Fixed test state isolation in NavigationService test suite
- Enabled monorepo test execution via Turborepo (pnpm test)

Fixes asyncapi#1246

Signed-off-by: SH20RAJ <shaswatraj3@gmail.com>
@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 955cffd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@netlify

netlify Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploy Preview for asyncapi-studio-design-system ready!

Name Link
🔨 Latest commit 955cffd
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-studio-design-system/deploys/6a98064ee852e8000824c63b
😎 Deploy Preview https://deploy-preview-1375--asyncapi-studio-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Sep 2, 2026

Copy link
Copy Markdown

Deploy Preview for modest-rosalind-098b67 ready!

Name Link
🔨 Latest commit 955cffd
🔍 Latest deploy log https://app.netlify.com/projects/modest-rosalind-098b67/deploys/6a98064e74212100084f6974
😎 Deploy Preview https://deploy-preview-1375--modest-rosalind-098b67.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

feat(tests): Improve unit test coverage for Studio services

1 participant