aboutsummaryrefslogtreecommitdiffstats
path: root/test/caldav/request/abstract_test.js
diff options
context:
space:
mode:
authorJames Lal <james@lightsofapollo.com>2013-05-06 21:18:31 -0700
committerJames Lal <james@lightsofapollo.com>2013-05-06 21:18:31 -0700
commit0b4733ebb28368198b747079d51033a7eeb1f276 (patch)
tree0d48aca900256baf82f0aa599d455a978780fa19 /test/caldav/request/abstract_test.js
parentc81e925aa6dada192db75dccd4287ab1e9e09ab2 (diff)
downloadjsCalDAV-0b4733ebb28368198b747079d51033a7eeb1f276.tar.gz
Initial error refactoring (make errors less HTTP specific)
Diffstat (limited to 'test/caldav/request/abstract_test.js')
-rw-r--r--test/caldav/request/abstract_test.js22
1 files changed, 13 insertions, 9 deletions
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 <div>', 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() {