Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 2.43 KB

File metadata and controls

83 lines (56 loc) · 2.43 KB

@workglow/test

Testing utilities and sample data for Workglow AI task pipelines.

Overview

The @workglow/test package provides testing utilities, sample data, and in-memory implementations for developing and testing Workglow AI applications. It includes mock repositories, sample task configurations, and helper functions for setting up test environments.

Features

  • In-Memory Repositories: Mock implementations of task graph and output repositories for testing
  • Sample Data: Pre-configured sample tasks and workflows for testing and development
  • Test Bindings: Helper functions for setting up test environments
  • Multi-Platform Support: Works in browser, Node.js, and Bun environments

Installation

npm install @workglow/test
# or
bun add @workglow/test

Usage

In-Memory Repositories

import { InMemoryTaskGraphRepository, InMemoryTaskOutputRepository } from "@workglow/test";

// Create in-memory repositories for testing
const taskGraphRepo = new InMemoryTaskGraphRepository();
const taskOutputRepo = new InMemoryTaskOutputRepository();

Sample Data and Models

import { registerHuggingfaceLocalModels, registerMediaPipeTfJsLocalModels } from "@workglow/test";

// Register sample AI models for testing
await registerHuggingfaceLocalModels();
await registerMediaPipeTfJsLocalModels();

AI Provider Setup

import { registerHuggingFaceTransformersInline } from "@workglow/ai-provider/hf-transformers/runtime";

// Set up HuggingFace Transformers inline for testing
await registerHuggingFaceTransformersInline();

API Reference

Repositories

  • InMemoryTaskGraphRepository - In-memory implementation of task graph storage
  • InMemoryTaskOutputRepository - In-memory implementation of task output storage
  • IndexedDbTaskGraphRepository - Browser-based IndexedDB storage for task graphs
  • IndexedDbTaskOutputRepository - Browser-based IndexedDB storage for task outputs

Sample Registration Functions

  • registerHuggingfaceLocalModels() - Registers sample HuggingFace models
  • registerMediaPipeTfJsLocalModels() - Registers sample MediaPipe TensorFlow.js models

Dependencies

This package depends on other Workglow packages:

  • @workglow/ai
  • @workglow/ai-provider
  • @workglow/job-queue
  • @workglow/storage
  • @workglow/task-graph
  • @workglow/tasks
  • @workglow/util

License

Apache 2.0 - See LICENSE for details.