@@ -216,16 +216,22 @@ describe('Evaluate: ', () => {
216216 result . should . equal ( testData . a )
217217 } )
218218
219- it ( 'should throw error if an argument is null' , ( ) => {
220- ( ( ) => { evaluate ( 'a + null' , testData ) } ) . should . throw ( )
219+ it ( 'should return same if an argument is null' , ( ) => {
220+ const result = evaluate ( 'a + null' , testData )
221+
222+ result . should . equal ( testData . a )
221223 } )
222224
223- it ( 'should throw error if an argument is undefined' , ( ) => {
224- ( ( ) => { evaluate ( 'a + undefined' , testData ) } ) . should . throw ( )
225+ it ( 'should return NaN if an argument is undefined' , ( ) => {
226+ const result = evaluate ( 'a + undefined' , testData )
227+
228+ result . should . be . NaN
225229 } )
226230
227- it ( 'should throw error if an argument is NaN' , ( ) => {
228- ( ( ) => { evaluate ( 'a + NaN' , testData ) } ) . should . throw ( )
231+ it ( 'should return NaN if an argument is NaN' , ( ) => {
232+ const result = evaluate ( 'a + NaN' , testData )
233+
234+ result . should . be . NaN
229235 } )
230236
231237 it ( 'should add true to numbers' , ( ) => {
@@ -260,16 +266,22 @@ describe('Evaluate: ', () => {
260266 result . should . equal ( testData . a )
261267 } )
262268
263- it ( 'should throw error if an argument is null' , ( ) => {
264- ( ( ) => { evaluate ( 'a - null' , testData ) } ) . should . throw ( )
269+ it ( 'should return 0 if an argument is null' , ( ) => {
270+ const result = evaluate ( 'a - null' , testData )
271+
272+ result . should . equal ( testData . a )
265273 } )
266274
267- it ( 'should throw error if an argument is undefined' , ( ) => {
268- ( ( ) => { evaluate ( 'a - undefined' , testData ) } ) . should . throw ( )
275+ it ( 'should return NaN if an argument is undefined' , ( ) => {
276+ const result = evaluate ( 'a - undefined' , testData )
277+
278+ result . should . be . NaN
269279 } )
270280
271- it ( 'should throw error if an argument is NaN' , ( ) => {
272- ( ( ) => { evaluate ( 'a - NaN' , testData ) } ) . should . throw ( )
281+ it ( 'should return NaN if an argument is NaN' , ( ) => {
282+ const result = evaluate ( 'a - NaN' , testData )
283+
284+ result . should . be . NaN
273285 } )
274286
275287 it ( 'should subtract true from numbers' , ( ) => {
@@ -311,16 +323,22 @@ describe('Evaluate: ', () => {
311323 res . should . equal ( testData . b )
312324 } )
313325
314- it ( 'should throw error if an argument is null' , ( ) => {
315- ( ( ) => { evaluate ( 'a * null' , testData ) } ) . should . throw ( )
326+ it ( 'should return 0 if an argument is null' , ( ) => {
327+ const result = evaluate ( 'a * null' , testData )
328+
329+ result . should . equal ( 0 )
316330 } )
317331
318- it ( 'should throw error if an argument is undefined' , ( ) => {
319- ( ( ) => { evaluate ( 'a * undefined' , testData ) } ) . should . throw ( )
332+ it ( 'should return NaN if an argument is undefined' , ( ) => {
333+ const result = evaluate ( 'a * undefined' , testData )
334+
335+ result . should . be . NaN
320336 } )
321337
322- it ( 'should throw error if an argument is NaN' , ( ) => {
323- ( ( ) => { evaluate ( 'a * NaN' , testData ) } ) . should . throw ( )
338+ it ( 'should return NaN if an argument is NaN' , ( ) => {
339+ const result = evaluate ( 'a * NaN' , testData )
340+
341+ result . should . be . NaN
324342 } )
325343
326344 it ( 'should flip the sign of Infinity' , ( ) => {
@@ -376,16 +394,22 @@ describe('Evaluate: ', () => {
376394 isNaN ( result ) . should . equal ( true )
377395 } )
378396
379- it ( 'should throw error if an argument is null' , ( ) => {
380- ( ( ) => { evaluate ( 'a / null' , testData ) } ) . should . throw ( )
397+ it ( 'should return Infinity if an argument is null' , ( ) => {
398+ const result = evaluate ( 'a / null' , testData )
399+
400+ result . should . equal ( 0 )
381401 } )
382402
383- it ( 'should throw error if an argument is undefined' , ( ) => {
384- ( ( ) => { evaluate ( 'a / undefined' , testData ) } ) . should . throw ( )
403+ it ( 'should return NaN if an argument is undefined' , ( ) => {
404+ const result = evaluate ( 'a / undefined' , testData )
405+
406+ result . should . be . NaN
385407 } )
386408
387- it ( 'should throw error if an argument is NaN' , ( ) => {
388- ( ( ) => { evaluate ( 'a / NaN' , testData ) } ) . should . throw ( )
409+ it ( 'should return NaN if an argument is NaN' , ( ) => {
410+ const result = evaluate ( 'a / NaN' , testData )
411+
412+ result . should . be . NaN
389413 } )
390414 } )
391415
0 commit comments