Socket
Book a DemoInstallSign in
Socket

@squiz/ai-tool-test-helpers

Package Overview
Dependencies
Maintainers
74
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@squiz/ai-tool-test-helpers

Test utilities for DXP AI Tools

latest
npmnpm
Version
0.0.1
Version published
Weekly downloads
0
Maintainers
74
Weekly downloads
 
Created
Source

@squiz/tool-test-helpers

Test utilities for DXP AI Tools that use the ToolHandler signature from @squiz/dxp-tool-sdk.

Installation

npm install --save-dev @squiz/tool-test-helpers

Usage

callToolHandler

Helper function to test tool handlers with minimal parameters. Only input is required; all other parameters (config, system, session, logger) are mocked automatically.

import { callToolHandler } from '@squiz/tool-test-helpers';
import { handler } from './tool';

describe('My Tool', () => {
  it('should work with minimal params', async () => {
    const result = await callToolHandler(handler, {
      input: { foo: 'bar' }
    });

    expect(result.success).toBe(true);
  });

  it('should work with custom logger', async () => {
    const mockLogger = { error: jest.fn() };

    const result = await callToolHandler(handler, {
      input: { foo: 'bar' },
      logger: mockLogger
    });

    expect(mockLogger.error).toHaveBeenCalled();
  });
});

createMockToolHandlerParams

Creates full mock parameters for ToolHandler if you need more control:

import { createMockToolHandlerParams } from '@squiz/tool-test-helpers';

const params = createMockToolHandlerParams({
  input: { foo: 'bar' },
  config: {
    id: 'custom-id',
    name: 'Custom Tool',
    // ... other config
  }
});

Features

  • ✅ Full TypeScript support
  • ✅ Works with any ToolHandler signature
  • ✅ Provides sensible defaults for all parameters
  • ✅ Allows selective parameter override
  • ✅ Mock logger included by default

Keywords

testing

FAQs

Package last updated on 02 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts