Last active
July 18, 2019 23:06
-
-
Save wcravens/8cebda50c572e7fc13765fba710980bc to your computer and use it in GitHub Desktop.
module test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* jshint expr:true */ | |
/* globals describe, it, beforeEach */ | |
var chai = require( 'chai' ) | |
, expect = chai.expect | |
; | |
var moduleNames = ['lib/recurringDateObjects']; | |
var moduleMethods = []; | |
moduleNames.map( ( moduleName ) => { | |
describe( 'Module Pattern: ' + moduleName, function () { | |
describe( 'initialization', () => { | |
var myTestModule = require( moduleName ); | |
it( 'should have a messages property', () => { | |
expect( myTestModule ).to.have.property( 'messages' ); | |
} ); | |
it( 'should be an init function', () => { | |
expect( myTestModule ).to.be.a( 'function' ); | |
} ); | |
it( 'should throw if missing configuration on initialization', () => { | |
expect( () => myTestModule() ).to.throw( myTestModule.messages.mustProvideAnInitObject ); | |
} ); | |
it.skip( 'should be ok if object is passed on initialization.', function () { | |
//noinspection BadExpressionStatementJS | |
expect( require( moduleName )( {} ) ).to.be.ok; | |
} ); | |
} ); | |
describe.skip( 'initialized', () => { | |
before( function() { | |
var myTestModule = require( moduleName )( {} ); | |
} ); | |
moduleMethods.forEach( name => { | |
it( 'should provide a ' + name + ' function', | |
() => expect( myTestModule[name] ).to.be.a( 'function' ) ); | |
} ); | |
} ); | |
} ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment