Skip to content

Commit

Permalink
(issue #4) add more tests, increment version a bit based on small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcalhoun committed Jun 9, 2013
1 parent 20e99ad commit afbe25d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This is inspired by [node-jsontoxml](https://github.com/soldair/node-jsontoxml),
### Features
* supports a variety of inputs: objects, arrays, strings,
* tabbed output (optional)
* custom filters (& -> &, etc) (optional)
* custom filters (<code>&</code> -> <code>&amp;</code>, etc) (optional)

### Installation
* npm install jstoxml
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jstoxml",
"version": "0.2.1",
"version": "0.2.2",
"description": "Convert JSON to XML (for RSS, Podcasts, etc.)",
"homepage": "http://github.com/davidcalhoun/jstoxml",
"main": "./jstoxml.js",
Expand Down
24 changes: 20 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,30 @@ var jstoxml = require('./jstoxml.js');
});

addTest({
name: 'bug4',
name: 'bug4a',
input: function(){
return jstoxml.toXML({
foo: 4
foo: 4,
bar: '&'
});
},
expectedOutput: '<foo>true</foo><bar></bar><foo2>false</foo2><ok>This is ok</ok><ok2>false</ok2><ok3>true</ok3>'
});
expectedOutput: '<foo>4</foo><bar>&</bar>'
});

addTest({
name: 'bug4b',
input: function(){
return jstoxml.toXML({
foo: '&'
},
{
filter: {
'&': '&amp;'
}
});
},
expectedOutput: '<foo>&amp;</foo>'
});

runTests();
showReport();
Expand Down

0 comments on commit afbe25d

Please sign in to comment.