1
0
Fork 0

Add mixin testing to common vformat functions

* test/validate/formatter/common.js (testMixin): Added.
master
Mike Gerwitz 2016-06-23 10:48:02 -04:00
parent ac52f42d1c
commit bc45b70644
1 changed files with 46 additions and 1 deletions

View File

@ -91,5 +91,50 @@ module.exports = {
);
} );
} );
}
},
/**
* Test that mixin respects supertype data
*
* @param {Function} Super supertype constructor to extend
* @param {Trait} Sut SUT trait
* @param {string} base string to serve as base to data
* @param {string} given given data to pass to extended Super
* @param {string} parse expected #parse result
* @param {string} retrieve expected #retrieve result
*
* @return {undefined}
*/
testMixin: function( Super, Sut, base, given, parse, retrieve )
{
describe( 'as a mixin', function()
{
var sut = Super.extend(
{
'virtual override parse': function( data )
{
return base + data;
},
'virtual override retrieve': function( data )
{
return base + data;
}
} ).use( Sut )();
it( 'respects supertype #parse', function()
{
expect( sut.parse( given ) )
.to.equal( parse );
} );
it( 'respects supertype #retrieve', function()
{
expect( sut.retrieve( given ) )
.to.equal( retrieve );
} );
} );
},
};