From 0b4733ebb28368198b747079d51033a7eeb1f276 Mon Sep 17 00:00:00 2001 From: James Lal Date: Mon, 6 May 2013 21:18:31 -0700 Subject: Initial error refactoring (make errors less HTTP specific) --- test/caldav/request/abstract_test.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'test/caldav/request/abstract_test.js') diff --git a/test/caldav/request/abstract_test.js b/test/caldav/request/abstract_test.js index e2fb3d1..18d6bc3 100644 --- a/test/caldav/request/abstract_test.js +++ b/test/caldav/request/abstract_test.js @@ -77,22 +77,26 @@ suite('caldav/request/abstract.js', function() { assert.deepEqual(con.password, req.password); }); - suite('error', function() { + suite('errors', function() { var calledWith; - setup(function(done) { + setup(function() { subject.send(function() { calledWith = arguments; - done(); }); - - xhr = getXhr(); - xhr.respond('NOT XML
', 500); }); - test('on response', function() { - assert.equal(calledWith[0].code, 500); - }); + function verifyStatusFailure(status, name) { + test('status ' + status, function() { + xhr = getXhr(); + xhr.respond('', status); + assert.equal(calledWith[0].name, name); + }); + } + + verifyStatusFailure(403, 'caldav-unknown'); + verifyStatusFailure(401, 'caldav-authentication'); + verifyStatusFailure(500, 'caldav-server-failure'); }); suite('success', function() { -- cgit