Skip to content
Browse files

Implemented //book/title

  • Loading branch information...
1 parent 2951d8a commit a82df2b0131c209ea59175eaab319c09cd8470a1 @StevenLooman committed Aug 14, 2012
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/saxpath.js
View
17 test/saxpath.js
@@ -89,6 +89,23 @@ describe('SaXPath', function() {
}
});
+ it('should match //book/title', function(done) {
+ var fileStream = fs.createReadStream('test/bookstore.xml');
+ var recorder = new TestRecorder();
+ var saxParser = sax.createStream(true);
+ var streamer = new xps.SaXPath(saxParser, '//book/title', recorder);
+ console.log(streamer);
+
+ saxParser.on('end', testNodesRecorded);
+ fileStream.pipe(saxParser);
+
+ function testNodesRecorded() {
+ assert.ok(recorder.tape.length > 0);
+ assert.equal(recorder.tape[0].name, 'title');
+ done();
+ }
+ });
+
it('should match //book//title', function(done) {
var fileStream = fs.createReadStream('test/bookstore.xml');
var recorder = new TestRecorder();

0 comments on commit a82df2b

Please sign in to comment.
Something went wrong with that request. Please try again.