@@ -24,14 +24,12 @@ describe("options", () => {
2424 const options = {
2525 aliasString : "="
2626 } ;
27- let originalOptions = options . aliasString ;
2827 assert . strictEqual ( new Options ( options ) . aliasString ,
29- originalOptions ) ;
28+ options . aliasString ) ;
3029
3130 options . aliasString = "test" ;
32- originalOptions = options . aliasString ;
3331 assert . strictEqual ( new Options ( options ) . aliasString ,
34- originalOptions ) ;
32+ options . aliasString ) ;
3533 } ) ;
3634
3735 it ( "should throw an error if the value of the property is"
@@ -54,16 +52,14 @@ describe("options", () => {
5452 const options = {
5553 attributeString : "@"
5654 } ;
57- let stringifiedOptions = options . attributeString ;
5855 assert . strictEqual (
5956 new Options ( options ) . attributeString ,
60- stringifiedOptions ) ;
57+ options . attributeString ) ;
6158
6259 options . attributeString = "test" ;
63- stringifiedOptions = options . attributeString ;
6460 assert . strictEqual (
6561 new Options ( options ) . attributeString ,
66- stringifiedOptions ) ;
62+ options . attributeString ) ;
6763 } ) ;
6864
6965 it ( "should throw an error if the value of the property is"
@@ -87,16 +83,14 @@ describe("options", () => {
8783 const options = {
8884 cdataInvalidChars : false
8985 } ;
90- let originalOptions = options . cdataInvalidChars ;
9186 assert . strictEqual (
9287 new Options ( options ) . cdataInvalidChars ,
93- originalOptions ) ;
88+ options . cdataInvalidChars ) ;
9489
9590 options . cdataInvalidChars = true ;
96- originalOptions = options . cdataInvalidChars ;
9791 assert . strictEqual (
9892 new Options ( options ) . cdataInvalidChars ,
99- originalOptions ) ;
93+ options . cdataInvalidChars ) ;
10094 } ) ;
10195
10296 it ( "should throw an error if the value of the property is"
@@ -120,16 +114,12 @@ describe("options", () => {
120114 const options = {
121115 cdataKeys : [ "test" , "test2" ]
122116 } ;
123- let stringifiedOptions = JSON . stringify ( options . cdataKeys ) ;
124- assert . strictEqual (
125- JSON . stringify ( new Options ( options ) . cdataKeys ) ,
126- stringifiedOptions ) ;
117+ assert . deepEqual ( new Options ( options ) . cdataKeys ,
118+ options . cdataKeys ) ;
127119
128120 options . cdataKeys = [ ] ;
129- stringifiedOptions = JSON . stringify ( options . cdataKeys ) ;
130- assert . strictEqual (
131- JSON . stringify ( new Options ( options ) . cdataKeys ) ,
132- stringifiedOptions ) ;
121+ assert . deepEqual ( new Options ( options ) . cdataKeys ,
122+ options . cdataKeys ) ;
133123 } ) ;
134124
135125 it ( "should throw an error if the value of the property is"
@@ -148,31 +138,31 @@ describe("options", () => {
148138 it ( "should return a validated version of the specified property"
149139 + " if undefined" , ( ) => {
150140 const options = { } ;
151- assert . strictEqual (
152- JSON . stringify ( new Options ( options ) . cdataKeys ) ,
153- JSON . stringify ( [ ] ) ) ;
141+ assert . deepEqual ( new Options ( options ) . cdataKeys , [ ] ) ;
154142 } ) ;
155143 } ) ;
156144
157145 describe ( "declaration" , ( ) => {
158146 it ( "should leave the specified property unchanged if valid" , ( ) => {
159147 const options = {
160148 declaration : {
161- include : true
149+ encoding : undefined ,
150+ include : true ,
151+ standalone : undefined ,
152+ version : undefined
162153 }
163154 } ;
164- let stringifiedOptions = JSON . stringify ( options . declaration ) ;
165- assert . strictEqual (
166- JSON . stringify ( new Options ( options ) . declaration ) ,
167- stringifiedOptions ) ;
155+ assert . deepEqual ( new Options ( options ) . declaration ,
156+ options . declaration ) ;
168157
169158 options . declaration = {
170- include : false
159+ encoding : undefined ,
160+ include : false ,
161+ standalone : undefined ,
162+ version : undefined
171163 } ;
172- stringifiedOptions = JSON . stringify ( options . declaration ) ;
173- assert . strictEqual (
174- JSON . stringify ( new Options ( options ) . declaration ) ,
175- stringifiedOptions ) ;
164+ assert . deepEqual ( new Options ( options ) . declaration ,
165+ options . declaration ) ;
176166 } ) ;
177167
178168 it ( "should throw an error if the specified options object"
@@ -193,32 +183,37 @@ describe("options", () => {
193183 it ( "should return a validated version of the specified property"
194184 + " if undefined" , ( ) => {
195185 const options = { } ;
196- const validatedOptions = new Options ( options ) ;
197- assert . strictEqual (
198- JSON . stringify ( validatedOptions . declaration ) ,
199- JSON . stringify ( { include : true } ) ) ;
186+ assert . deepEqual ( new Options ( options ) . declaration ,
187+ {
188+ encoding : undefined ,
189+ include : true ,
190+ standalone : undefined ,
191+ version : undefined
192+ } ) ;
200193 } ) ;
201194 } ) ;
202195
203196 describe ( "dtd" , ( ) => {
204197 it ( "should leave the specified property unchanged if valid" , ( ) => {
205198 const options = {
206199 dtd : {
207- include : false
200+ include : false ,
201+ name : undefined ,
202+ pubId : undefined ,
203+ sysId : undefined
208204 }
209205 } ;
210- let stringifiedOptions = JSON . stringify ( options . dtd ) ;
211- assert . strictEqual (
212- JSON . stringify ( new Options ( options ) . dtd ) ,
213- stringifiedOptions ) ;
206+ assert . deepEqual ( new Options ( options ) . dtd ,
207+ options . dtd ) ;
214208
215209 options . dtd = {
216- include : true
210+ include : true ,
211+ name : undefined ,
212+ pubId : undefined ,
213+ sysId : undefined
217214 } ;
218- stringifiedOptions = JSON . stringify ( options . dtd ) ;
219- assert . strictEqual (
220- JSON . stringify ( new Options ( options ) . dtd ) ,
221- stringifiedOptions ) ;
215+ assert . deepEqual ( new Options ( options ) . dtd ,
216+ options . dtd ) ;
222217 } ) ;
223218
224219 it ( "should throw an error if the specified options object"
@@ -239,22 +234,28 @@ describe("options", () => {
239234 it ( "should return a validated version of the specified property"
240235 + " if undefined" , ( ) => {
241236 const options = { } ;
242- const validatedOptions = new Options ( options ) ;
243- assert . strictEqual (
244- JSON . stringify ( validatedOptions . dtd ) ,
245- JSON . stringify ( { include : false } ) ) ;
237+ assert . deepEqual ( new Options ( options ) . dtd ,
238+ {
239+ include : false ,
240+ name : undefined ,
241+ pubId : undefined ,
242+ sysId : undefined
243+ } ) ;
246244 } ) ;
247245 } ) ;
248246
249247 describe ( "format" , ( ) => {
250248 it ( "should leave the specified property unchanged if valid" , ( ) => {
251249 const options = {
252- format : { }
250+ format : {
251+ doubleQuotes : undefined ,
252+ indent : undefined ,
253+ newline : undefined ,
254+ pretty : undefined
255+ }
253256 } ;
254- const stringifiedOptions = JSON . stringify ( options . format ) ;
255- assert . strictEqual (
256- JSON . stringify ( new Options ( options ) . format ) ,
257- stringifiedOptions ) ;
257+ assert . deepEqual ( new Options ( options ) . format ,
258+ options . format ) ;
258259 } ) ;
259260
260261 it ( "should throw an error if the specified options object"
@@ -268,10 +269,13 @@ describe("options", () => {
268269 it ( "should return a validated version of the specified property"
269270 + " if undefined" , ( ) => {
270271 const options = { } ;
271- const validatedOptions = new Options ( options ) ;
272- assert . strictEqual (
273- JSON . stringify ( validatedOptions . format ) ,
274- JSON . stringify ( { } ) ) ;
272+ assert . deepEqual ( new Options ( options ) . format ,
273+ {
274+ doubleQuotes : undefined ,
275+ indent : undefined ,
276+ newline : undefined ,
277+ pretty : undefined
278+ } ) ;
275279 } ) ;
276280 } ) ;
277281
@@ -288,20 +292,12 @@ describe("options", () => {
288292 const options = {
289293 typeHandlers
290294 } ;
291- let stringifiedOptions = JSON . stringify (
292- options . typeHandlers ) ;
293- assert . strictEqual (
294- JSON . stringify (
295- new Options ( options ) . typeHandlers ) ,
296- stringifiedOptions ) ;
295+ assert . deepEqual ( new Options ( options ) . typeHandlers ,
296+ options . typeHandlers ) ;
297297
298298 options . typeHandlers = { } ;
299- stringifiedOptions = JSON . stringify (
300- options . typeHandlers ) ;
301- assert . strictEqual (
302- JSON . stringify (
303- new Options ( options ) . typeHandlers ) ,
304- stringifiedOptions ) ;
299+ assert . deepEqual ( new Options ( options ) . typeHandlers ,
300+ options . typeHandlers ) ;
305301 } ) ;
306302
307303 it ( "should throw an error if the value of the property is"
@@ -322,9 +318,7 @@ describe("options", () => {
322318 it ( "should return a validated version of the specified property"
323319 + " if undefined" , ( ) => {
324320 const options = { } ;
325- assert . strictEqual (
326- JSON . stringify ( new Options ( options ) . typeHandlers ) ,
327- JSON . stringify ( { } ) ) ;
321+ assert . deepEqual ( new Options ( options ) . typeHandlers , { } ) ;
328322 } ) ;
329323 } ) ;
330324
@@ -333,16 +327,14 @@ describe("options", () => {
333327 const options = {
334328 valueString : "#"
335329 } ;
336- let originalOptions = options . valueString ;
337330 assert . strictEqual (
338331 new Options ( options ) . valueString ,
339- originalOptions ) ;
332+ options . valueString ) ;
340333
341334 options . valueString = "test" ;
342- originalOptions = options . valueString ;
343335 assert . strictEqual (
344336 new Options ( options ) . valueString ,
345- originalOptions ) ;
337+ options . valueString ) ;
346338 } ) ;
347339
348340 it ( "should throw an error if the value of the property is"
@@ -374,20 +366,12 @@ describe("options", () => {
374366 const options = {
375367 wrapHandlers
376368 } ;
377- let stringifiedOptions = JSON . stringify (
378- options . wrapHandlers ) ;
379- assert . strictEqual (
380- JSON . stringify (
381- new Options ( options ) . wrapHandlers ) ,
382- stringifiedOptions ) ;
369+ assert . deepEqual ( new Options ( options ) . wrapHandlers ,
370+ options . wrapHandlers ) ;
383371
384372 options . wrapHandlers = { } ;
385- stringifiedOptions = JSON . stringify (
386- options . wrapHandlers ) ;
387- assert . strictEqual (
388- JSON . stringify (
389- new Options ( options ) . wrapHandlers ) ,
390- stringifiedOptions ) ;
373+ assert . deepEqual ( new Options ( options ) . wrapHandlers ,
374+ options . wrapHandlers ) ;
391375 } ) ;
392376
393377 it ( "should throw an error if the value of the property is"
@@ -408,9 +392,7 @@ describe("options", () => {
408392 it ( "should return a validated version of the specified property"
409393 + " if undefined" , ( ) => {
410394 const options = { } ;
411- assert . strictEqual (
412- JSON . stringify ( new Options ( options ) . wrapHandlers ) ,
413- JSON . stringify ( { } ) ) ;
395+ assert . deepEqual ( new Options ( options ) . wrapHandlers , { } ) ;
414396 } ) ;
415397 } ) ;
416398 } ) ;
0 commit comments