Permalink
Browse files

Implemented //book//title

  • Loading branch information...
StevenLooman committed Aug 14, 2012
1 parent 6c2587a commit 2951d8ad4e5e1fe128fdad8080f8d2b64bc0645c
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/saxpath.js
View
@@ -88,4 +88,21 @@ describe('SaXPath', function() {
done();
}
});
+
+ 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();
+ }
+ });
});

0 comments on commit 2951d8a

Please sign in to comment.