New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

billingsdk-test

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

billingsdk-test

Testing utilities for Billing SDK

latest
npmnpm
Version
0.1.1
Version published
Weekly downloads
4
100%
Maintainers
1
Weekly downloads
 
Created
Source

billingsdk-test

Testing utilities for Billing SDK. Includes a deterministic test adapter (zero API calls) and a shared compliance test suite.

Installation

npm install billingsdk-core billingsdk-test --save-dev

Usage

Test adapter

import { createTestBilling } from "billingsdk-test";
import { plans } from "./plans";

const billing = createTestBilling({ plans });

const customer = await billing.test.createCustomer({
  externalId: "user_123",
});

await billing.test.activateSubscription({
  customerId: customer.id,
  plan: "pro",
});

const result = await billing.entitlements.check({
  customerId: customer.id,
  feature: "custom_domain",
});
expect(result.allowed).toBe(true);

Test actions

MethodDescription
createCustomer()Create a test customer
activateSubscription()Activate a subscription for a customer
cancelSubscription()Cancel a subscription
expireSubscription()Expire a subscription immediately
setSubscriptionStatus()Set subscription status directly
incrementUsage()Increment usage for a meter
emitWebhook()Emit a simulated webhook event

Compliance tests

import { runAdapterComplianceTests, createTestBilling } from "billingsdk-test";
import { plans } from "./plans";

const factory = () => createTestBilling({ plans });
runAdapterComplianceTests(factory);

Exports

  • createTestBilling() — Create a billing client with the in-memory test adapter
  • runAdapterComplianceTests() — Run shared compliance tests against any adapter factory

FAQs

Package last updated on 16 Jul 2026

Related posts