Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jdg

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

jdg

A set of helpers to compare results and expected results during testing.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

jdg v1.0.0 Build Status

A simple set of tools for comparing given and expected results. It is meant to be semantically clear and concise, returning a simple truthy response. This is ideal for testing.

Installation

To use jdg throughout your project:

$ npm install --save jdg

To only use jdg for testing, add jdg to your devDependencies and:

$ npm install jdg

Examples

A testing example using mocha and shouldjs:

var jdg = require('jdg');
var should = require('should');

describe('GET /users', function() {
  it('should include Bob', function() {
    var users = someRequest('/users');
    jdg.isInArray(users, {name: 'Bob', id: 4}).should.equal(true);
  });
});

And an example using jdg outside of your testing suite:

var jdg = require('jdg');

function updateUser(user, attrs, opts) {
  attrs.forEach(function(attr) {
    if (jdg.isInArray(user.baseAttrs, attr)) {
      // do something
    }
  });
}

Jdg's underlying helpers is and get are also exposed for use:

function updateUser(user, attrs, opts) {
  if (jdg.is.missing(user)) {
    // throw some error
  } else {
    var userAttrs = judge.get.keys(user);
    // do something
  }
}

Issues

If you're using jdg and find a problem, feel free to report the issue here on Github. This helps determine if an issue has already been reported and if there is a fix already in progress.

Keywords

FAQs

Package last updated on 04 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc