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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mockingbird-sdk

v1.0.3

Published

A simple SDK for database testing with AI feedback

Downloads

14

Readme

Mockingbird SDK Documentation

Installation

npm i mockingbird-sdk

Configuration

Step 1: Create a Configuration File

Create a mockingbird.config.json file in your project root:

{
  "databases": {
    "main": {
      "type": "mysql",
      "connection": {
        "host": "${HOST}",
        "user": "${USER}",
        "password": "${PASSWORD}",
        "database": "${DATABASE}",
        "port": "${PORT}"
      }
    },
    "reporting": {
      "type": "postgres",
      "connection": {
        "host": "${REPORTING_PG_HOST}",
        "user": "${REPORTING_PG_USER}",
        "password": "${REPORTING_PG_PASSWORD}",
        "database": "${REPORTING_PG_DATABASE}",
        "port": "${REPORTING_PG_PORT}"
      }
    }
  },
  "testPatterns": [
    "tests/**/*.test.js"
  ],
  "reportConfig": {
    "type": "file",
    "outputPath": "./test-reports/report.json"
  }
}

Step 2: Create an Environment File

Create a .env file in your project root with the necessary environment variables:

HOST=your_host
PORT=your_port
USER=your_username
PASSWORD=your_password
DATABASE=your_database_name

REPORTING_PG_HOST=your_reporting_host
REPORTING_PG_PORT=your_reporting_port
REPORTING_PG_USER=your_reporting_username
REPORTING_PG_PASSWORD=your_reporting_password
REPORTING_PG_DATABASE=your_reporting_database_name

Usage

Example Test File

Create a test file (e.g., tests/db.test.js):

const { mockingbirdSDK } = require('mockingbird-sdk');

// Set the default database
mockingbirdSDK.setDefaultDatabase('main');

mockingbirdSDK
  .test('Count distinct issues for specific board in date range')
  .query(\`
    SELECT 
      COUNT(DISTINCT i.id) AS issue_count
    FROM 
      issues i
      JOIN board_issues bi ON i.id = bi.issue_id
      JOIN boards b ON bi.board_id = b.id
    WHERE
      i.created_date BETWEEN FROM_UNIXTIME(?) AND FROM_UNIXTIME(?)
      AND b.id = ?
  \`, 1721070312, 1736967912, 'github:GithubRepo:1:290006')
  .expectRowCount(1);

// Run all tests
mockingbirdSDK.run();

Running Tests

Run your tests using the Mockingbird CLI:

npx mockingbird

Example Test Cases

1. Simple Count Query

mockingbirdSDK
  .test('Count total users')
  .query('SELECT COUNT(*) AS user_count FROM users')
  .expect('user_count', 100)
  .expectRowCount(1);

2. Data Integrity Check

mockingbirdSDK
  .test('Ensure no duplicate email addresses')
  .query('SELECT email, COUNT(*) AS count FROM users GROUP BY email HAVING COUNT(*) > 1')
  .expectRowCount(0);

3. Join Query with Multiple Expectations

mockingbirdSDK
  .test('Validate order details for a specific user')
  .query(\`
    SELECT u.username, o.order_id, o.total_amount
    FROM users u
    JOIN orders o ON u.id = o.user_id
    WHERE u.username = ?
  \`, 'john_doe')
  .expect('username', 'john_doe')
  .expect('total_amount', 99.99)
  .expectRowCount(1);

4. Date Range Query

mockingbirdSDK
  .test('Check orders within a date range')
  .query(\`
    SELECT COUNT(*) AS order_count
    FROM orders
    WHERE order_date BETWEEN ? AND ?
  \`, '2023-01-01', '2023-12-31')
  .expect('order_count', 500);

5. Complex Aggregation

mockingbirdSDK
  .test('Analyze user activity')
  .query(\`
    SELECT 
      u.user_type,
      AVG(a.login_count) AS avg_logins,
      MAX(a.last_active_date) AS latest_activity
    FROM users u
    JOIN user_activity a ON u.id = a.user_id
    GROUP BY u.user_type
  \`)
  .expectRowCount(3)
  .expect('avg_logins', (value) => value > 0);

License

This SDK is licensed under MIT License.