aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichal Budzynski <michal@virtualdesign.pl>2012-11-06 11:54:07 -0800
committerMichal Budzynski <michal@virtualdesign.pl>2012-11-08 16:16:07 -0800
commitb74223999c5a240306132704177eb9cbb1dc9143 (patch)
treef2980f8379b9abfaebf2fe7d41d0a9415cd13517 /test
parent84c07224a04189d42abbcd2dbfaf541fa53a90ff (diff)
downloadjsCalDAV-b74223999c5a240306132704177eb9cbb1dc9143.tar.gz
error handler
a error-handling a err
Diffstat (limited to 'test')
-rw-r--r--test/caldav/request/abstract_test.js4
-rw-r--r--test/caldav/request/calendar_home_test.js24
-rw-r--r--test/caldav/sax/dav_response_test.js6
3 files changed, 28 insertions, 6 deletions
diff --git a/test/caldav/request/abstract_test.js b/test/caldav/request/abstract_test.js
index 88d8b2b..ee70b67 100644
--- a/test/caldav/request/abstract_test.js
+++ b/test/caldav/request/abstract_test.js
@@ -83,9 +83,9 @@ suite('caldav/request/abstract.js', function() {
xhr = getXhr();
xhr.respond('NOT XML <div>', 500);
});
-
+
test('on response', function() {
- assert.match(calledWith[0].message, /http error/);
+ assert.equal(calledWith[0].code, 500);
});
});
diff --git a/test/caldav/request/calendar_home_test.js b/test/caldav/request/calendar_home_test.js
index 88eb905..13483ad 100644
--- a/test/caldav/request/calendar_home_test.js
+++ b/test/caldav/request/calendar_home_test.js
@@ -9,6 +9,7 @@ suite('caldav/request/propfind', function() {
var MockRequest;
var MockPropfind;
var Home;
+ var Errors;
var subject;
var con;
@@ -19,6 +20,7 @@ suite('caldav/request/propfind', function() {
Connection = Caldav.require('connection');
Home = Caldav.require('request/calendar_home');
MockRequest = Caldav.require('support/mock_request');
+ Errors = Caldav.require('request/errors');
});
suiteSetup(function() {
@@ -74,7 +76,7 @@ suite('caldav/request/propfind', function() {
response[url] = {
'current-user-principal': {
status: '200',
- value: 'foo.com/'
+ value: { href:'foo.com/' }
}
};
@@ -94,7 +96,7 @@ suite('caldav/request/propfind', function() {
},
'principal-URL': {
status: '200',
- value: 'bar.com/'
+ value: { href: 'bar.com/' }
}
};
@@ -102,6 +104,24 @@ suite('caldav/request/propfind', function() {
assert.equal(data, 'bar.com/');
});
+
+ test('unauthenticated', function() {
+ var req = request('_findPrincipal');
+
+ response[url] = {
+ 'principal-URL': {
+ status: '200',
+ value: {
+ unauthenticated: {}
+ }
+ }
+ };
+
+ req.respond(null, response);
+
+ assert.equal(true, err instanceof Errors.UnauthenticatedError);
+ });
+
});
suite('#_findCalendarHome', function() {
diff --git a/test/caldav/sax/dav_response_test.js b/test/caldav/sax/dav_response_test.js
index 926f975..d435ef8 100644
--- a/test/caldav/sax/dav_response_test.js
+++ b/test/caldav/sax/dav_response_test.js
@@ -85,7 +85,9 @@ suite('caldav/sax/dav_response', function() {
'principal-URL': {
status: '200',
- value: '/calendar/pinc/'
+ value: {
+ href: '/calendar/pinc/'
+ }
},
resourcetype: {
@@ -98,7 +100,7 @@ suite('caldav/sax/dav_response', function() {
'current-user-principal': {
status: '404',
- value: null
+ value: {}
}
},