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

challenge

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

challenge

A node.js mocha unit test generator with support for JSON case data.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by300%
Maintainers
2
Weekly downloads
 
Created
Source

challenge

============

A node.js unit test generator with support for JSON case data

Code Climate Coverage Status Build Status Dependency Status devDependency Status

Examples:

Dynamically generate tests within a Mocha test suite using a JSON array:

Challenge
	.cases(['first', 'second'])
	.test('should generate two tests',
	function(pCase, fDone)
	{
		Expect(pCase)
			.to.be.a('string');

		return fDone();
	});

Or, load JSON data from a file and generate tests for each selected element in an array:

Challenge
	.cases({loadFrom:'case-data.json', range: [0,1]})
	.test('should generate tests from json data',
	function(pCase, fDone)
	{
		Expect(pCase)
			.to.have.property('name');
		Expect(pCase.id.toString())
			.to.equal(pCase.name[pCase.name.length-1]); //id should match last letter of 'name'

		return fDone();
	});

See the unit test for more complex examples, including joining and grouping test case data to generate tests.

Keywords

FAQs

Package last updated on 30 Aug 2017

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