diff options
author | James Lal <james@lightsofapollo.com> | 2012-06-19 22:07:17 -0700 |
---|---|---|
committer | James Lal <james@lightsofapollo.com> | 2012-06-19 22:07:17 -0700 |
commit | 038911be29c875e0fcd24472e815167bb98ce833 (patch) | |
tree | 8d762fb3e0d812aeab6dab262d6f6bd411940344 /test/webcals/sax/dav_response_test.js | |
parent | be947b56151b774d4b555097f2b8a8b4f47b633d (diff) | |
download | jsCalDAV-038911be29c875e0fcd24472e815167bb98ce833.tar.gz |
wip xml parsing
Diffstat (limited to 'test/webcals/sax/dav_response_test.js')
-rw-r--r-- | test/webcals/sax/dav_response_test.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/test/webcals/sax/dav_response_test.js b/test/webcals/sax/dav_response_test.js new file mode 100644 index 0000000..8e84e6b --- /dev/null +++ b/test/webcals/sax/dav_response_test.js @@ -0,0 +1,75 @@ +requireLib('sax'); +requireLib('sax/base'); +requireLib('sax/dav_response'); + +suite('webcals/sax/base', function() { + + var data, + subject, + parser, + Parse, + Response, + Base, + handler; + + + suiteSetup(function() { + Parse = Webcals.require('sax'); + Base = Webcals.require('sax/base'); + Response = Webcals.require('sax/dav_response'); + }); + + setup(function() { + //we omit the option to pass base parser + //because we are the base parser + subject = new Parse(); + subject.registerHandler('DAV:/response', Response); + }); + + suite('parsing', function() { + var xml; + + defineSample('xml/propget.xml', function(data) { + xml = data; + }); + + expected = { + '/calendar/user': { + + 'principal-URL': { + status: '200', + value: '/calendar/user/' + }, + + resourcetype: { + status: '200', + value: [ + 'principal', + 'collection' + ] + } + }, + + '/calendar/other': { + missing: { + status: '200', + value: {} + } + } + }; + + test('output', function(done) { + subject.once('complete', function(data) { + console.log(JSON.stringify(data)); + //assert.deepEqual( + //data, expected, + //"expected \n '" + JSON.stringify(data) + "'\n to equal \n '" + + //JSON.stringify(expected) + '\n"' + //); + done(); + }); + subject.write(xml).close(); + }); + }); + +}); |