'use strict';
var extractValues = require('../src/extractValues.js').extractValues;
var stream = require('stream');
function stringStream(str) {
return new stream.Readable({
read: function(n) {
this.push(str);
str = null;
}
});
}
describe('extractValues', function() {
it('should extract the values from the xml', function(done) {
var str = '' +
'';
extractValues(stringStream(str), {'IDS': 'Y'}, function(values) {
expect(values).toEqual({ IDS_Y : [['0001', '0002']] });
done();
});
});
it('should extract the values from the xml if the last element matches', function(done) {
var str = '' +
'';
extractValues(stringStream(str), {'IDS': 'Y'}, function(values) {
expect(values).toEqual({ IDS_Y : [['0001', '0003']] });
done();
});
});
it('should support `reserved`', function(done) {
var str = '' +
'';
extractValues(stringStream(str), {'IDS': 'Y'}, function(values) {
expect(values).toEqual({ IDS_Y : [['0001', '0001'], ['0006', '0006']] });
done();
});
});
it('should support `surrogate`', function(done) {
var str = '' +
'';
extractValues(stringStream(str), {'IDS': 'Y'}, function(values) {
expect(values).toEqual({ IDS_Y : [['0001', '0001'], ['0006', '0006']] });
done();
});
});
it('should support `noncharactere`', function(done) {
var str = '' +
'';
extractValues(stringStream(str), {'IDS': 'Y'}, function(values) {
expect(values).toEqual({ IDS_Y : [['0001', '0001'], ['0006', '0006']] });
done();
});
});
});