Skip to content

chore: add tests #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

chore: add tests #103

wants to merge 16 commits into from

Conversation

MQ37
Copy link
Contributor

@MQ37 MQ37 commented Apr 29, 2025

closes #57
closes #97

by default for npm run test only unit tests are executed as they do not require Apify API token

Features:

  • more unit tests
  • stdio integration tests
  • Actor MCP server SSE and streamable HTTP integration tests
  • helper tool

@github-actions github-actions bot added t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics. labels Apr 29, 2025
@MQ37 MQ37 marked this pull request as ready for review May 2, 2025 13:16
@jirispilka jirispilka added the high priority Do this ASAP! This is for mission-critical work or work that blocks other teams in their work. label May 5, 2025
@MQ37 MQ37 requested a review from jirispilka May 6, 2025 12:51
* add help tool

* Update src/tools/helpers.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix: move tool text into a constant

* fix: helpTool text

* Update src/tools/helpers.ts

Co-authored-by: Jiří Spilka <jiri.spilka@apify.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jiri Spilka <jirka.spilka@gmail.com>
Co-authored-by: Jiří Spilka <jiri.spilka@apify.com>
beforeEach(async () => {
// same as in main.ts
// TODO: unify
server = createActorMCPServer();
Copy link
Collaborator

Choose a reason for hiding this comment

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

server is created twice. I would really remove the createActorMCPServer function. Can you handle TODO as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the createActorMCPServer wrapper and TODO since I copied the logic from main.ts so it's unified.

server is created twice.

You mean there is separate server for each describe block? If so that is correct, I wanted to split the different transport tests so they can run in parallel so it spawns two server instances on different ports. Since the Actor MCP server logic is coupled and only single-tenant the actual tests (it blocks) must run in serial.

Copy link
Collaborator

@jirispilka jirispilka left a comment

Choose a reason for hiding this comment

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

I didn’t have time to look at the test in detail,
but overall, it looks good. I’ve left a few comments that should be addressed before merging.

MQ37 added 2 commits May 6, 2025 19:57
…rectly, removed duplicate tools.actor tests and renamed actor.test.ts, removed old TODOs
for each state to fix MaxListenersExceededWarning
@MQ37 MQ37 requested a review from Copilot May 6, 2025 18:13
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds enhanced test coverage across unit and integration tests while also updating some helper functionality and default configurations.

  • Introduces a new test timeout in the Vitest configuration
  • Adds multiple unit tests for utilities and updates import paths
  • Implements a help tool in the MCP server and adjusts default tool configurations

Reviewed Changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vitest.config.ts Added a test timeout setting
tests/unit/*.test.ts & tests/integration/stdio.test.ts Added and updated unit and integration tests
tests/helpers.ts Introduced helper functions for various client transports
src/tools/helpers.ts Added a help tool with extensive inline documentation
src/mcp/server.ts Updated default tools and added reset/close methods
src/const.ts Updated default actors and helper tool configuration
tests/actor-server-test.ts Removed obsolete actor server tests
tests/README.md Added documentation for running tests
Files not reviewed (1)
  • package.json: Language not supported
Comments suppressed due to low confidence (2)

src/const.ts:33

  • Verify that the removal of the default actor 'apify/instagram-scraper' (and related entries) is intentional, as this alters the expected configuration of default actors.
-        'apify/instagram-scraper',

src/tools/helpers.ts:12

  • [nitpick] Consider externalizing the lengthy inline help text into a dedicated documentation file or module to improve maintainability and readability of the source code.
const HELP_TOOL_TEXT = `Apify MCP server help: ...

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority Do this ASAP! This is for mission-critical work or work that blocks other teams in their work. t-ai Issues owned by the AI team. tested Temporary label used only programatically for some analytics.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify default tools loading Add tests and mock calls
2 participants