Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <gerwitm@lovullo.com>2015-05-12 14:24:24 -0400
committerMike Gerwitz <gerwitm@lovullo.com>2015-05-12 16:32:49 -0400
commit8fbd4dd2209481c529f6b23f29f8a26c6d5c775b (patch)
tree5e28e52871404a67a1de7fe787e2e9082335b7a9 /test
parentd4328968e89d739731e3c443a661551c117add1b (diff)
downloadliza-8fbd4dd2209481c529f6b23f29f8a26c6d5c775b.tar.gz
liza-8fbd4dd2209481c529f6b23f29f8a26c6d5c775b.tar.bz2
liza-8fbd4dd2209481c529f6b23f29f8a26c6d5c775b.zip
XhrHttpImpl#serveError
Diffstat (limited to 'test')
-rw-r--r--test/dapi/http/XhrHttpImplTest.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/dapi/http/XhrHttpImplTest.js b/test/dapi/http/XhrHttpImplTest.js
index 1256f1c..eeebde3 100644
--- a/test/dapi/http/XhrHttpImplTest.js
+++ b/test/dapi/http/XhrHttpImplTest.js
@@ -222,6 +222,38 @@ describe( 'XhrHttpImpl', function()
} );
+ it( 'allows customizing error', function( done )
+ {
+ var _self = this,
+ chk = {};
+
+ var StubXhr = createStubXhr();
+ StubXhr.prototype.status = 404;
+
+ Sut.extend(
+ {
+ 'override protected serveError': function( req, callback )
+ {
+ var e = Error( 'foobunny' );
+ e.foo = true;
+
+ expect( req ).to.be.an.instanceOf( StubXhr );
+
+ callback( e, chk );
+ },
+ } )( StubXhr )
+ .requestData( 'http://foo', 'GET', '', function( err, resp )
+ {
+ expect( ( err || {} ).foo ).to.be.ok;
+ expect( resp ).to.equal( chk );
+
+ done();
+ } );
+
+ StubXhr.inst.send( '' );
+ } );
+
+
it( 'returns self', function()
{
var sut = Sut( function() {} ),