challenge

1.0.7 • Public • Published

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.

Package Sidebar

Install

npm i challenge

Weekly Downloads

10

Version

1.0.7

License

MIT

Last publish

Collaborators

  • wisam82
  • jasonhillier