testing
БесплатноБез исполняемых скриптовНе проверенRun and troubleshoot tests for DBHub, including unit tests, integration tests with Testcontainers, and database-specific tests. Use when asked to run tests…
Об этом скилле
Testing Skill
This skill helps you run, write, and troubleshoot tests in the DBHub project.
Test Commands
pnpm test # Run all tests (unit + integration)
pnpm test:unit # Unit tests only (no Docker needed)
pnpm test:watch # Interactive watch mode
pnpm test:integration # Integration tests only (requires Docker)
pnpm test:build # After `pnpm run build`: import every connector chunk in dist/
pnpm test:mcpb # After `pnpm run build:mcpb`: smoke-test the packed bundle over stdio
Run a specific test file:
pnpm test src/connectors/__tests__/postgres.integration.test.ts
pnpm test src/utils/__tests__/allowed-keywords.test.ts
Run tests matching a name pattern:
pnpm test -- --testNamePattern="PostgreSQL"
Verbose output for debugging:
pnpm test:integration --reporter=verbose
Test Architecture
Vitest is configured with two projects in vitest.config.ts:
- unit: All
*.test.tsfiles excluding*integration*in the filename - integration: Only
*integration*.test.tsfiles
This means the naming convention matters — integration tests MUST have integration in their filename to be correctly categorized.
Test File Locations
Unit tests (*.test.ts without integration in the name; no Docker needed):
src/utils/__tests__/— Utility function tests (SQL parsing and classification, access policy, row limiting, DSN obfuscation, SafeURL, SQLite DSNs, SSH config and tunnel, identifier quoting, parameter mapping, result columns, query timeouts, config watcher, auth token, cross-origin, AWS RDS signer, …)src/tools/__tests__/— Tool handler tests (execute-sql, search-objects, explain-sql, health-check, custom-tool-handler, registry, builtin-tools)src/config/__tests__/— Configuration tests (env parsing, TOML loading)src/connectors/__tests__/— Connector unit tests (dsn-parser, manager, oracle, clickhouse (against a fake HTTP server), per-connector timeout / auth / pool behaviour, read-only transaction strategy)src/requests/__tests__/— Request store testssrc/__tests__/— Connector loading andplugin-consistency.test.ts(plugin / bundle / registry manifests stay in step withpackage.json)
Integration tests (integration in the file name). List them with git ls-files 'src/**/*integration*.test.ts'.
Need Docker (Testcontainers):
src/connectors/__tests__/postgres.integration.test.tssrc/connectors/__tests__/postgres-ssh.integration.test.tssrc/connectors/__tests__/postgres-client-cert.integration.test.tssrc/connectors/__tests__/mysql.integration.test.tssrc/connectors/__tests__/mariadb.integration.test.tssrc/connectors/__tests__/sqlserver.integration.test.tssrc/connectors/__tests__/oracle.integration.test.tssrc/connectors/__tests__/clickhouse.integration.test.ts
Run without Docker (in-memory SQLite or no database):
src/connectors/__tests__/sqlite.integration.test.tssrc/connectors/__tests__/multi-sqlite-sources.integration.test.tssrc/__tests__/json-rpc-integration.test.tssrc/__tests__/http-bind-host.integration.test.tssrc/api/__tests__/sources.integration.test.tssrc/api/__tests__/requests.integration.test.tssrc/config/__tests__/ssh-config-integration.test.tssrc/utils/__tests__/tool-metadata.integration.test.tssrc/tools/__tests__/builtin-tool-table.integration.test.ts
IntegrationTestBase
Database connector integration tests extend IntegrationTestBase<TContainer> from src/connectors/__tests__/shared/integration-test-base.ts. This abstract class provides:
- Lifecycle:
registerLifecycle()registers thebeforeAll(container start, 120s timeout → connect → setup test data) andafterAll(cleanup) hooks - Shared test suites:
createCommonTests()runs all ofcreateConnectionTests(),createSchemaTests(),createTableTests(),createSQLExecutionTests(),createStoredProcedureTests(),createCommentTests(),createErrorHandlingTests(),createMaxRowsTests()andcreateReadonlyBackstopTests();createSSLTests()is opt-in for engines whose container can report session encryption (expectSessionEncryptionhook) - Dialect hooks:
DatabaseTestConfigflags gate the tests an engine cannot run;userLimitedSQL(n)is overridden where the row limit is notLIMIT(SQL ServerTOP, OracleFETCH FIRST) withConnector(config, fn): connects a second connector with the givenConnectorConfig, runsfn, and always disconnects — use it instead of a hand-written connect / try / finally- Standard test data:
userstable (id, name, email, age) +orderstable (id, user_id, amount) +test_schema.products
To add a new database connector test, extend this class and implement:
createContainer()— Start the Testcontainers instancecreateConnector()— Create the database connectorsetupTestData(connector)— Populate test tables
MySQL and MariaDB share
Установить testing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл testing?
Run and troubleshoot tests for DBHub, including unit tests, integration tests with Testcontainers, and database-specific tests. Use when asked to run tests, fix test failures, debug integration tests, troubleshoot Docker/database container issues, or add new tests. Also use when verifying code changes work correctly or when CI test failures need investigation.
Как установить скилл testing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл testing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic