Registry / testing / better-queue-store-test

better-queue-store-test

JSON →
library1.0.3jsnpmunverified

A testing utility library for verifying custom store implementations compatible with the better-queue package. Version 1.0.3 is the latest stable release. This package provides a test suite interface to ensure that custom queue stores (e.g., memory, database-backed) conform to the expected API and behavior. It integrates with Mocha and is intended as a dev dependency for store authors. Key differentiator: it reduces manual testing overhead and guarantees compatibility with better-queue's features.

npm install better-queue-store-test
INSTALL
IMPORT
SIG · BETTER-QUEUE-STORE
B
better-queue-store-test
testingjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

basic
const basic = require('better-queue-store-test').basic;
import { basic } from 'better-queue-store-test';
This library is CommonJS only; no ESM exports. Use require().
test
const test = require('better-queue-store-test'); test.basic(...)
const { test } = require('better-queue-store-test');
The module exports the test functions directly, not under a 'test' property.
StoreTestInterface
// No TypeScript types provided; use JSDoc or any
import { StoreTestInterface } from 'better-queue-store-test';
This package does not ship TypeScript declarations. Errors if you attempt to import types.

Shows how to use the test utility to validate a memory store (from better-queue-memory) against the basic store test suite.

const test = require('better-queue-store-test'); const { MemoryStore } = require('better-queue-memory'); test.basic('Memory Store Test', { create: function (cb) { const store = new MemoryStore(); cb(null, store); }, destroy: function (cb) { // No cleanup needed for memory store cb(); } });
Debug
Known issues
gotchaThe library does not export ESM modules; using import will fail.
fix
Use require() instead of import.
affects: >=1.0.0
gotchaThe 'basic' test assumes Mocha is installed and runs in a Mocha context; using with other test frameworks may require adapters.
fix
Install Mocha as a dev dependency and run tests with mocha command.
affects: >=1.0.0
gotchaThe 'basic' test requires a 'create' function that calls back with a store instance; incorrect callback signature causes test failures.
fix
Ensure the callback is called with (error, store) where error is null on success.
affects: >=1.0.0
gotchaThe 'destroy' function is optional but must be provided to avoid undefined errors if your store requires cleanup.
fix
Always provide a destroy function that calls cb(); for no-op stores, use cb(null).
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: test.basic is not a function
Incorrect import: using destructured import from an ESM-aware bundler that cannot handle CommonJS module.
fix
Use const test = require('better-queue-store-test'); then test.basic(...).
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called
The create or destroy callback was not invoked within the default timeout (2 seconds).
fix
Ensure your create/destroy functions call the callback promptly, or increase Mocha timeout with --timeout.
AssertionError: expected undefined to be an object
The create callback returned without a store instance (e.g., cb() instead of cb(null, store)).
fix
Call cb(null, store) with a valid store object.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
better-queuerequiredpeer dependency required for store compatibility
Agent activity
20 hits · last 30 days
node
16
OpenAI (training)
2
Resources
better-queue-store-test — npm install better-queue-store-test · libregistry