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

crude-test

v0.0.1

Published

API Test Helpers for crude.

Readme

crude-test

API Test Helpers for crude.

Build Status

Install

Install the module using NPM:

npm install crude-test --save

Table of Contents

  1. Overview
  2. API

Overview

crude-test provides a convenient, fast and effective way to test your endpoints that were created using the crude package. Usage is pretty straighforward:

var CrudeTest = require('crude-test');

// load internal modules
var userFix = require('./fixtures/user.fix');
var UserEnt = require('./entities/user.ent');

// initialize the Crude tester
var crudeTest = new CrudeTest({
    endpoint: '/user',
    fixture: userFix.one,
    stringAttr: 'firstName',
    idAttr: '_id',
    uniqueAttr: 'email',
    Entity: UserEnt,
});

// run the tests
crudeTest.run();

API

Constructor

  • Object= optOptions Optionally define a set of options.

The crude-test package exposes a constructor that you need to invoke with the new keyword.

var CrudeTest = require('crude-test');

var crudeTest = new CrudeTest();

setup(options)

  • Object options A set of options

You may invoke setup() after the instanciation to configure the crude-test instance.

Options

Find bellow all the available options to configure crude-test. In type definitions the = symbol means that the property is optional, all properties not having the equal symbol are REQUIRED:

* *hostname* `string` The hostname to perform the tests against, i.e. `http://localhost:3000`.
* *endpoint* `string` The endpoint to test, i.e. `/user`.
* *fixture* `Object` the data fixture to use, provide a data object to use for creating items.
* *stringAttr* `string` A string attribute in the fixture to use for updating and query filtering, any string type attribute will do.
* *uniqueAttr* `string` An attribute that acts as a unique identifier of the record, e.g. the email if the model is a user, in an empty db this can be any field, not neccessarily an actually unique one.
* *Entity* `Entity` The [entity instance](https://github.com/thanpolas/entity) of the model to be tested.
* *create* `Object` Create OP related parameters:
    * *response* `Function` A node.js style callback with the tests res.
* *readList* `Object` Read List OP related parameters:
    * *response* `Function` A node.js style callback with the tests res.
* *readItem* `Object` Read Item OP related parameters:
    * *response* `Function` A node.js style callback with the tests res.
* *readFilter* `Object` Read Filter OP related parameters:
    * *response* `Function` A node.js style callback with the tests res.
* *update* `Object` Update OP related parameters:
    * *response* `Function` A node.js style callback with the tests res.
* *delete* `Object` Delete OP related parameters:
    * *response* `Function` A node.js style callback with the tests res.

[⬆]

Release History

  • v0.0.1, 04 Jul 2014
    • Big Bang

License

Copyright (c) 2014 Thanasis Polychronakis. Licensed under the MIT license.