shape-tests
v0.0.0
Published
Convenience shape test generator using chai, designed to run in mocha
Readme
Shape Test Generator
Generates 'it' statements based on an object that holds properties and methods that relate to the exposed properties and functions on an object/module
Example usage:
var components = require('.<your module to test>');
var generateFunctionSignatureExpects = require('shape-tests').generateFunctionSignatureExpects;
var generatePropertyExpects = require('shape-tests').generatePropertyExpects;
describe('My Module: ', function() {
'use strict';
var coreShape = {
properties: [{
name: 'somePropString',
type: 'string'
}, {
name: 'someBoolean',
type: 'boolean'
}, {
name: 'someObject',
type: 'object'
}],
methods: [{
name: 'someMethod',
numArgs: 3
}, {
name: 'someOtherMethod',
numArgs: 2
}]
};
describe('Components:', function() {
generateFunctionSignatureExpects(components, coreShape.methods);
generatePropertyExpects(components, coreShape.properties);
});
}); 