1+ var jsonLogic = require ( '../logic.js' ) ;
2+
13var real_console = console . log , last_console ;
24console . log = function ( logged ) { last_console = logged ; real_console . apply ( this , arguments ) ; } ;
35
4-
56QUnit . test ( "Bad operator" , function ( assert ) {
67 assert . throws (
7- function ( ) { jsonLogic ( { "fubar" : [ ] } ) ; } ,
8+ function ( ) { jsonLogic . apply ( { "fubar" : [ ] } ) ; } ,
89 / U n r e c o g n i z e d o p e r a t i o n /
910 ) ;
1011} ) ;
@@ -47,7 +48,7 @@ QUnit.test( "Shared JsonLogic.com tests ", function( assert ){
4748 expected = test [ 2 ] ;
4849
4950 assert . deepEqual (
50- jsonLogic ( rule , data ) ,
51+ jsonLogic . apply ( rule , data ) ,
5152 expected ,
5253 "jsonLogic(" + JSON . stringify ( rule ) + "," + JSON . stringify ( data ) + ") = " + expected
5354 ) ;
@@ -58,10 +59,10 @@ QUnit.test( "Shared JsonLogic.com tests ", function( assert ){
5859} ) ;
5960
6061QUnit . test ( "logging" , function ( assert ) {
61- assert . equal ( jsonLogic ( { "log" : [ 1 ] } ) , 1 ) ;
62+ assert . equal ( jsonLogic . apply ( { "log" : [ 1 ] } ) , 1 ) ;
6263 assert . equal ( last_console , 1 ) ;
6364} ) ;
6465
6566QUnit . test ( "edge cases" , function ( assert ) {
66- assert . equal ( jsonLogic ( ) , undefined , "Called with no arguments" ) ;
67+ assert . equal ( jsonLogic . apply ( ) , undefined , "Called with no arguments" ) ;
6768} ) ;
0 commit comments