Socket
Book a DemoInstallSign in
Socket

shape-tests

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shape-tests

Convenience shape test generator using chai, designed to run in mocha

latest
Source
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

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

}); 

Keywords

shape

FAQs

Package last updated on 29 Oct 2014

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