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-zeptomail

v0.2.0

Published

Mock SDK for Zoho ZeptoMail API

Readme

@codepunter-labs/mock-zeptomail

Mock SDK for Zoho ZeptoMail API. Provides fully-typed mock implementations for testing transactional email sending, templates, domains, and email logs without making real API calls.

npm version GitHub

Installation

npm install @codepunter-labs/mock-zeptomail

Features

  • Email Sending: Send single and batch transactional emails
  • Templates: Create, update, list, and delete email templates
  • Domains: Manage sending domains with verification
  • Email Logs: Track email delivery status and logs
  • 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-zeptomail
  • Source Code: src/
  • Tests: tests/

Usage

Basic Setup

import { vi } from 'vitest';
import { createMockZeptoMail } from '@codepunter-labs/mock-zeptomail';

const zeptoMail = createMockZeptoMail({ spy: vi.fn });

Using with Jest

import { createMockZeptoMail } from '@codepunter-labs/mock-zeptomail';

const zeptoMail = createMockZeptoMail({ spy: jest.fn });

Example: Send Email

// Default behavior - returns realistic mock data
const result = await zeptoMail.sendEmail({
  from: { address: '[email protected]', name: 'Sender' },
  to: [{ address: '[email protected]', name: 'Recipient' }],
  subject: 'Test Email',
  html: '<p>Hello World</p>'
});

Example: Send Batch Email

const result = await zeptoMail.sendBatchEmail({
  from: { address: '[email protected]' },
  to: [
    [{ address: '[email protected]' }],
    [{ address: '[email protected]' }]
  ],
  subject: 'Batch Email',
  text: 'Hello World'
});

Example: Create Template

const result = await zeptoMail.createTemplate({
  templateName: 'Welcome Email',
  subject: 'Welcome',
  htmlContent: '<h1>Welcome {{name}}</h1>'
});

Example: Override Mock Response

import { makeSendEmailResponse } from '@codepunter-labs/mock-zeptomail';

zeptoMail.sendEmail.mockResolvedValue({
  message: 'Email sent successfully',
  data: makeSendEmailResponse({ messageId: 'custom_msg_123' })
});

Example: Error Simulation

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

zeptoMail.sendEmail.mockRejectedValue(
  MockErrors.badRequest('Invalid email address')
);

API Reference

MockZeptoMail

  • sendEmail(request) - Send single email
  • sendBatchEmail(request) - Send batch email
  • createTemplate(request) - Create email template
  • updateTemplate(request) - Update email template
  • getTemplate(templateId) - Get template details
  • listTemplates() - List all templates
  • deleteTemplate(templateId) - Delete template
  • createDomain(request) - Create domain
  • updateDomain(request) - Update domain
  • getDomain(domainId) - Get domain details
  • listDomains() - List all domains
  • verifyDomain(domainId) - Verify domain
  • deleteDomain(domainId) - Delete domain
  • getEmailLogs(options?) - Get email logs
  • getEmailLog(messageId) - Get specific email log

Fixture Factories

  • makeEmailAddress(address, name?) - Create email address
  • makeSendEmailResponse(options?) - Create send email response
  • makeBatchEmailResponse(options?) - Create batch email response
  • makeTemplate(options?) - Create template
  • makeDomain(options?) - Create domain
  • makeEmailLog(options?) - Create email log

Testing Patterns

Test Success Path

test('should send email successfully', async () => {
  const zeptoMail = createMockZeptoMail({ spy: vi.fn });
  
  const result = await zeptoMail.sendEmail(request);
  
  expect(result.message).toBe('Email sent successfully');
  expect(result.data.messageId).toBeDefined();
});

Test Error Handling

test('should handle invalid email address error', async () => {
  const zeptoMail = createMockZeptoMail({ spy: vi.fn });
  
  zeptoMail.sendEmail.mockRejectedValue(
    ZeptoMailErrors.invalidEmail()
  );
  
  await expect(zeptoMail.sendEmail(request)).rejects.toMatchObject({ message: /Invalid email/ });
});

Test with Custom Data

test('should use custom message ID', async () => {
  const zeptoMail = createMockZeptoMail({ spy: vi.fn });
  
  zeptoMail.sendEmail.mockResolvedValue({
    message: 'Email sent successfully',
    data: makeSendEmailResponse({ messageId: 'custom_msg_123' })
  });
  
  const result = await zeptoMail.sendEmail(request);
  expect(result.data.messageId).toBe('custom_msg_123');
});

License

MIT zeptoMail.sendEmail.mockResolvedValue({ message: 'Email sent successfully', data: makeSendEmailResponse({ messageId: 'custom_msg_123' }) });

const result = await zeptoMail.sendEmail(request); expect(result.data.messageId).toBe('custom_msg_123'); });


## License

MIT