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

v0.2.0

Published

TODO

Readme

@codepunter-labs/mock-moolre

Mock SDK for Moolre API. Provides fully-typed mock implementations for testing Moolre account, transfers, payments, and SMS integrations without making real API calls.

npm version GitHub

Installation

npm install @codepunter-labs/mock-moolre

Features

  • Account: Create wallets, update accounts, check balance
  • Transfers: Send transfers
  • Payments: Process mobile money payments
  • SMS: Send SMS, generate and verify OTP
  • 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-moolre
  • Source Code: src/
  • Tests: tests/

Usage

Basic Setup

import { vi } from 'vitest';
import { createMockMoolre } from '@codepunter-labs/mock-moolre';

const moolre = createMockMoolre({ spy: vi.fn });

Using with Jest

import { createMockMoolre } from '@codepunter-labs/mock-moolre';

const moolre = createMockMoolre({ spy: jest.fn });

Example: Create Wallet

// Default behavior - returns realistic mock data
const result = await moolre.createWallet({
  accountname: 'My Business LTD',
  api: true,
  callback: 'https://example.com/webhook'
});

Example: Send Transfer

const result = await moolre.sendTransfer({
  accountnumber: '100000157291',
  amount: 100,
  recipient_account: '9207067319',
  recipient_bank: '000013',
  recipient_name: 'John Doe'
});

Example: Override Mock Response

import { makeWallet } from '@codepunter-labs/mock-moolre';

moolre.createWallet.mockResolvedValue({
  status: 1,
  code: 'WC02',
  message: 'Wallet Created Successfully',
  data: makeWallet({ accountname: 'Test Business' }),
  go: null
});

Example: Error Simulation

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

moolre.sendTransfer.mockRejectedValue(
  MockErrors.badRequest('Insufficient balance')
);

API Reference

MockMoolre

  • createWallet(request) - Create wallet
  • updateAccount(request) - Update account
  • getBalance() - Get account balance
  • sendTransfer(request) - Send transfer
  • processMobileMoneyPayment(request) - Process mobile money payment
  • sendSms(request) - Send SMS
  • generateOtp(request) - Generate OTP
  • verifyOtp(request) - Verify OTP

Fixture Factories

  • makeWallet(options?) - Create wallet
  • makeBalanceResponse(options?) - Create balance response
  • makeTransferResponse(options?) - Create transfer response
  • makePaymentResponse(options?) - Create payment response
  • makeSmsResponse(options?) - Create SMS response
  • makeOtpResponse(options?) - Create OTP response
  • makeVerifyOtpResponse(options?) - Create OTP verification response

Testing Patterns

Test Success Path

test('should create wallet successfully', async () => {
  const moolre = createMockMoolre({ spy: vi.fn });
  
  const result = await moolre.createWallet(request);
  
  expect(result.status).toBe(1);
  expect(result.message).toBe('Wallet Created Successfully');
});

Test Error Handling

test('should handle insufficient balance error', async () => {
  const moolre = createMockMoolre({ spy: vi.fn });
  
  moolre.sendTransfer.mockRejectedValue(
    MoolreErrors.insufficientBalance()
  );
  
  await expect(moolre.sendTransfer(request)).rejects.toMatchObject({ status: 0, code: 'TRF002' });
});

Test with Custom Data

test('should use custom wallet name', async () => {
  const moolre = createMockMoolre({ spy: vi.fn });
  
  moolre.createWallet.mockResolvedValue({
    status: 1,
    code: 'WC02',
    message: 'Wallet Created Successfully',
    data: makeWallet({ accountname: 'Custom Business' }),
    go: null
  });
  
  const result = await moolre.createWallet(request);
  expect(result.data.accountname).toBe('Custom Business');
});

License

MIT