This repository was archived by the owner on Jan 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree 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 () {
9999 it ( 'does xmlsanitize of text' , function ( done ) {
100100
101101 var xml = internals . readFixture ( 'xmlsanitize2.xml' ) ;
102- var result = parser . toJson ( xml , { sanitize : true } ) ;
102+ var result = parser . toJson ( xml , { sanitize : true , reversible : true } ) ;
103103 var json = internals . readFixture ( 'xmlsanitize2.json' ) ;
104104
105105 expect ( result ) . to . equal ( json ) ;
106106
107107 done ( ) ;
108108 } ) ;
109109
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+
110132 it ( 'throws error on bad options' , function ( done ) {
111133
112134 var throws = function ( ) {
You can’t perform that action at this time.
0 commit comments