npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codepunter-labs/mock-gcp-workflows

v0.2.0

Published

TODO

Readme

@codepunter-labs/mock-gcp-workflows

Mock SDK for Google Cloud Workflows API. Provides fully-typed mock implementations for testing Cloud Workflows integrations without making real API calls.

npm version GitHub

Installation

npm install @codepunter-labs/mock-gcp-workflows

Features

  • Workflows: Deploy, describe, list, and delete workflows
  • Executions: Execute, run, list, and describe workflow executions
  • Type-safe: Full TypeScript support with accurate API types
  • Test Framework Agnostic: Works with Jest, Vitest, and other spy-based frameworks

Repository

  • GitHub: https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-gcp-workflows
  • Source Code: src/
  • Tests: tests/

Usage

Basic Setup

import { vi } from 'vitest';
import { createMockGcpWorkflows } from '@codepunter-labs/mock-gcp-workflows';

const workflows = createMockGcpWorkflows({ spy: vi.fn });

Using with Jest

import { createMockGcpWorkflows } from '@codepunter-labs/mock-gcp-workflows';

const workflows = createMockGcpWorkflows({ spy: jest.fn });

Example: Deploy Workflow

// Default behavior - returns realistic mock data
const result = await workflows.deployWorkflow({
  name: 'projects/test-project/locations/us-central1/workflows/my-workflow',
  sourceContents: 'main:\n  params: [args]\n  steps:\n    - call: log\n      args: ["Hello, ${args}"]'
});

Example: Execute Workflow

const result = await workflows.executeWorkflow(
  'projects/test-project/locations/us-central1/workflows/my-workflow',
  { argument: '{"name": "World"}' }
);

Example: Override Mock Response

import { makeWorkflowResponse } from '@codepunter-labs/mock-gcp-workflows';

workflows.deployWorkflow.mockResolvedValue(
  makeWorkflowResponse({ name: 'custom-workflow' })
);

Example: Error Simulation

import { MockErrors } from '@codepunter-labs/mock-core';

workflows.deployWorkflow.mockRejectedValue(
  MockErrors.badRequest('Invalid workflow definition')
);

API Reference

MockGcpWorkflows

  • deployWorkflow(request) - Deploy workflow
  • describeWorkflow(name) - Get workflow details
  • listWorkflows(parent) - List workflows
  • deleteWorkflow(name) - Delete workflow
  • executeWorkflow(parent, request) - Execute workflow
  • runWorkflow(parent, request) - Execute workflow and wait for completion
  • listExecutions(parent) - List executions
  • describeExecution(name) - Get execution details

Fixture Factories

  • makeWorkflowResponse(options?) - Create workflow response
  • makeExecutionResponse(options?) - Create execution response
  • makeExecuteWorkflowResponse(options?) - Create execute workflow response

Testing Patterns

Test Success Path

test('should deploy workflow successfully', async () => {
  const workflows = createMockGcpWorkflows({ spy: vi.fn });
  
  const result = await workflows.deployWorkflow(request);
  
  expect(result.state).toBe('ACTIVE');
  expect(result.name).toContain('workflows');
});

Test Error Handling

test('should handle invalid workflow definition error', async () => {
  const workflows = createMockGcpWorkflows({ spy: vi.fn });
  
  workflows.deployWorkflow.mockRejectedValue(
    GcpWorkflowsErrors.invalidWorkflowDefinition()
  );
  
  await expect(workflows.deployWorkflow(request)).rejects.toMatchObject({ message: /Invalid workflow definition/ });
});

Test with Custom Data

test('should use custom workflow state', async () => {
  const workflows = createMockGcpWorkflows({ spy: vi.fn });
  
  workflows.deployWorkflow.mockResolvedValue(
    makeWorkflowResponse({ state: 'UNAVAILABLE' })
  );
  
  const result = await workflows.deployWorkflow(request);
  expect(result.state).toBe('UNAVAILABLE');
});

License

MIT