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

v0.2.0

Published

TODO

Readme

@codepunter-labs/mock-arkesel

Mock SDK for Arkesel API. Provides fully-typed mock implementations for testing Arkesel SMS, OTP, Voice, and other integrations without making real API calls.

npm version GitHub

Installation

npm install @codepunter-labs/mock-arkesel

Features

  • SMS V2: Send SMS, get SMS details
  • OTP: Generate and verify one-time passwords
  • Voice: Send voice messages
  • Balance: Check account balance
  • Contact Groups: Create and manage contact groups
  • 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-arkesel
  • Source Code: src/
  • Tests: tests/

Usage

Basic Setup

import { vi } from 'vitest';
import { createMockArkesel } from '@codepunter-labs/mock-arkesel';

const arkesel = createMockArkesel({ spy: vi.fn });

Using with Jest

import { createMockArkesel } from '@codepunter-labs/mock-arkesel';

const arkesel = createMockArkesel({ spy: jest.fn });

Example: Send SMS

// Default behavior - returns realistic mock data
const result = await arkesel.sendSms({
  sender: 'Arkesel',
  message: 'Hello world',
  recipients: ['233544919953']
});

Example: Generate OTP

const result = await arkesel.generateOtp({
  recipient: '233544919953',
  expiry: 300,
  length: 6
});

Example: Override Mock Response

import { makeSendSmsResponse } from '@codepunter-labs/mock-arkesel';

arkesel.sendSms.mockResolvedValue({
  status: 'success',
  data: makeSendSmsResponse()
});

Example: Error Simulation

import { ArkeselErrors } from '@codepunter-labs/mock-arkesel';

arkesel.sendSms.mockRejectedValue(
  ArkeselErrors.invalidPhoneNumber()
);

API Reference

MockArkesel

| Method | Description | Source | |--------|-------------|--------| | sendSms(request) | Send SMS | mock-arkesel.ts | | getSmsDetails(smsId) | Get SMS details | mock-arkesel.ts | | generateOtp(request) | Generate OTP | mock-arkesel.ts | | verifyOtp(request) | Verify OTP | mock-arkesel.ts | | sendVoice(request) | Send voice message | mock-arkesel.ts | | getBalance() | Get account balance | mock-arkesel.ts | | createContactGroup(request) | Create contact group | mock-arkesel.ts | | addContactsToGroup(request) | Add contacts to group | mock-arkesel.ts |

Fixture Factories

| Factory | Description | Source | |---------|-------------|--------| | makeSmsRecipientResult(options?) | Create SMS recipient result | fixtures.ts | | makeSendSmsResponse(options?) | Create SMS response | fixtures.ts | | makeSmsDetails(options?) | Create SMS details | fixtures.ts | | makeGenerateOtpResponse(options?) | Create OTP response | fixtures.ts | | makeVerifyOtpResponse(options?) | Create OTP verification response | fixtures.ts | | makeSendVoiceResponse(options?) | Create voice response | fixtures.ts | | makeBalanceResponse(options?) | Create balance response | fixtures.ts | | makeContactGroup(options?) | Create contact group | fixtures.ts | | makeAddContactsToGroupResponse(options?) | Create add contacts response | fixtures.ts |

Error Factories

| Error | Description | Source | |-------|-------------|--------| | ArkeselErrors.invalidPhoneNumber() | Invalid phone number error | errors.ts | | ArkeselErrors.insufficientBalance() | Insufficient balance error | errors.ts | | ArkeselErrors.otpExpired() | OTP expired error | errors.ts | | ArkeselErrors.invalidOtp() | Invalid OTP error | errors.ts |

Testing Patterns

Test Success Path

test('should send SMS successfully', async () => {
  const arkesel = createMockArkesel({ spy: vi.fn });
  
  const result = await arkesel.sendSms(request);
  
  expect(result.status).toBe('success');
  expect(result.data.recipients).toHaveLength(1);
});

Test Error Handling

test('should handle invalid phone number error', async () => {
  const arkesel = createMockArkesel({ spy: vi.fn });
  
  arkesel.sendSms.mockRejectedValue(
    ArkeselErrors.invalidPhoneNumber()
  );
  
  await expect(arkesel.sendSms(request)).rejects.toMatchObject({ message: /Invalid phone number/ });
});

Test with Custom Data

test('should use custom OTP expiry', async () => {
  const arkesel = createMockArkesel({ spy: vi.fn });
  
  arkesel.generateOtp.mockResolvedValue({
    status: 'success',
    data: makeGenerateOtpResponse({ expiry: 600 })
  });
  
  const result = await arkesel.generateOtp(request);
  expect(result.data.expiry).toBe(600);
});

License

MIT