0.0.0 • Published 10 years ago

shape-tests v0.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
10 years ago

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);
    });

});