This repository was archived by the owner on Jan 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 1
- {"e" :" <b>Smith</b> & <b>Son</b>" }
1
+ {"e" :{ "$t" : " <b>Smith</b> & <b>Son</b>" } }
Original file line number Diff line number Diff line change 1
- <e >< b> Smith< /b> & < b> Son< /b> </e >
1
+ <e >< b> Smith< /b> & < b> Son< /b> </e >
Original file line number Diff line number Diff line change @@ -99,14 +99,36 @@ describe('xml2json', function () {
99
99
it ( 'does xmlsanitize of text' , function ( done ) {
100
100
101
101
var xml = internals . readFixture ( 'xmlsanitize2.xml' ) ;
102
- var result = parser . toJson ( xml , { sanitize : true } ) ;
102
+ var result = parser . toJson ( xml , { sanitize : true , reversible : true } ) ;
103
103
var json = internals . readFixture ( 'xmlsanitize2.json' ) ;
104
104
105
105
expect ( result ) . to . equal ( json ) ;
106
106
107
107
done ( ) ;
108
108
} ) ;
109
109
110
+ it ( 'does json unsanitize' , function ( done ) {
111
+
112
+ var json = internals . readFixture ( 'xmlsanitize.json' ) ;
113
+ var result = parser . toXml ( json , { sanitize : true } ) ;
114
+ var xml = internals . readFixture ( 'xmlsanitize.xml' ) ;
115
+
116
+ expect ( result ) . to . equal ( xml ) ;
117
+
118
+ done ( ) ;
119
+ } ) ;
120
+
121
+ it ( 'does json unsanitize of text' , function ( done ) {
122
+
123
+ var json = internals . readFixture ( 'xmlsanitize2.json' ) ;
124
+ var result = parser . toXml ( json , { sanitize : true } ) ;
125
+ var xml = internals . readFixture ( 'xmlsanitize2.xml' ) ;
126
+
127
+ expect ( result ) . to . equal ( xml ) ;
128
+
129
+ done ( ) ;
130
+ } ) ;
131
+
110
132
it ( 'throws error on bad options' , function ( done ) {
111
133
112
134
var throws = function ( ) {
You can’t perform that action at this time.
0 commit comments