Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2016-06-23 10:01:14 -0400
committerMike Gerwitz <gerwitm@lovullo.com>2016-06-23 10:12:59 -0400
commitac52f42d1c448188449950540a0115fafbcc0b30 (patch)
tree326fc3c45bae85b0a02922922e3ca1b2f1f9524d /test/validate
parent391a81953601818531df338521e24fde9a7a0fdd (diff)
downloadliza-ac52f42d1c448188449950540a0115fafbcc0b30.tar.gz
liza-ac52f42d1c448188449950540a0115fafbcc0b30.tar.bz2
liza-ac52f42d1c448188449950540a0115fafbcc0b30.zip
Add EchoFormatter
* src/validate/formatter/EchoFormatter.js: Added. * test/validate/formatter/EchoFormatterTest.js: Added.
Diffstat (limited to 'test/validate')
-rw-r--r--test/validate/formatter/EchoFormatterTest.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/test/validate/formatter/EchoFormatterTest.js b/test/validate/formatter/EchoFormatterTest.js
new file mode 100644
index 0000000..01133de
--- /dev/null
+++ b/test/validate/formatter/EchoFormatterTest.js
@@ -0,0 +1,65 @@
+/**
+ * Tests echo list formatter
+ *
+ * Copyright (C) 2016 LoVullo Associates, Inc.
+ *
+ * This file is part of liza.
+ *
+ * liza is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+var liza = require( '../../../' ),
+ Sut = liza.validate.formatter.EchoFormatter,
+ testValidate = require( './common' ).testValidate,
+ expect = require( 'chai' ).expect;
+
+
+describe( 'EchoListFormatter', function()
+{
+ testValidate( Sut(), {
+ "": [ "" ],
+ "foo": [ "foo" ],
+ " 123 ": [ " 123 " ],
+ } );
+
+
+ describe( 'as a supertype', function()
+ {
+ it( 'permits overriding #parse', function()
+ {
+ var expected = 'parsed';
+
+ expect(
+ Sut.extend(
+ {
+ 'override parse': function( _ ) { return expected; }
+ } )().parse( 'foo' )
+ ).to.equal( expected );
+ } );
+
+
+ it( 'permits overriding #retrieve', function()
+ {
+ var expected = 'retrieved';
+
+ expect(
+ Sut.extend(
+ {
+ 'override retrieve': function( _ ) { return expected; }
+ } )().retrieve( 'foo' )
+ ).to.equal( expected );
+ } );
+ } );
+} ); \ No newline at end of file