Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2016-06-23 10:48:02 -0400
committerMike Gerwitz <gerwitm@lovullo.com>2016-06-23 11:38:09 -0400
commitbc45b70644c51e3b35b6332449939254dee3627f (patch)
tree5a3d6b13c56fc06d6ee3bc0711d12111031a2835 /test
parentac52f42d1c448188449950540a0115fafbcc0b30 (diff)
downloadliza-bc45b70644c51e3b35b6332449939254dee3627f.tar.gz
liza-bc45b70644c51e3b35b6332449939254dee3627f.tar.bz2
liza-bc45b70644c51e3b35b6332449939254dee3627f.zip
Add mixin testing to common vformat functions
* test/validate/formatter/common.js (testMixin): Added.
Diffstat (limited to 'test')
-rw-r--r--test/validate/formatter/common.js47
1 files changed, 46 insertions, 1 deletions
diff --git a/test/validate/formatter/common.js b/test/validate/formatter/common.js
index af36ebe..2d0a292 100644
--- a/test/validate/formatter/common.js
+++ b/test/validate/formatter/common.js
@@ -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 );
+ } );
+ } );
+ },
};