@@ -2794,79 +2794,13 @@ describe('<Data> Parser', function() {
27942794 expect ( result2 [ 1 ] ) . to . be . instanceof ( FooClass )
27952795 } )
27962796
2797- it ( 'uses classes from global by default for data store object with inner instances' , async ( ) => {
2798- // eslint-disable-next-line no-console
2799- const _nativeConsoleWarn = console . warn
2800-
2801- // eslint-disable-next-line no-console
2802- const spyConsoleWarn = console . warn = chai . spy ( )
2803-
2804- global . FooClass = class FooClass {
2805- }
2806-
2807- global . BarFun = function BarFun ( ) {
2808- }
2809-
2810- dataStore = Backendless . Data . of ( tableName )
2811-
2812- const result1 = dataStore . parseResponse ( {
2813- foo : { ___class : 'FooClass' , value : 1 , } ,
2814- bar : { ___class : 'BarFun' , value : 2 , }
2815- } )
2816-
2817- const result2 = dataStore . parseResponse ( [
2818- { foo : { ___class : 'FooClass' , value : 3 , } , bar : { ___class : 'BarFun' , value : 5 , } } ,
2819- { foo : { ___class : 'FooClass' , value : 4 , } , bar : { ___class : 'BarFun' , value : 6 , } }
2820- ] )
2821-
2822- expect ( result1 ) . to . be . eql ( {
2823- foo : { ___class : 'FooClass' , value : 1 , } ,
2824- bar : { ___class : 'BarFun' , value : 2 , }
2825- } )
2826-
2827- expect ( result1 . foo ) . to . be . instanceof ( FooClass )
2828- expect ( result1 . bar ) . to . be . instanceof ( BarFun )
2829-
2830- expect ( result2 ) . to . be . eql ( [
2831- { foo : { ___class : 'FooClass' , value : 3 , } , bar : { ___class : 'BarFun' , value : 5 , } } ,
2832- { foo : { ___class : 'FooClass' , value : 4 , } , bar : { ___class : 'BarFun' , value : 6 , } }
2833- ] )
2834-
2835- expect ( result2 [ 0 ] . foo ) . to . be . instanceof ( FooClass )
2836- expect ( result2 [ 0 ] . bar ) . to . be . instanceof ( BarFun )
2837-
2838- expect ( result2 [ 1 ] . foo ) . to . be . instanceof ( FooClass )
2839- expect ( result2 [ 1 ] . bar ) . to . be . instanceof ( BarFun )
2840-
2841- expect ( spyConsoleWarn ) . to . have . been . called . exactly ( 6 )
2842-
2843- const warningMsg = (
2844- 'Resolving DataTable classes from the global scope is deprecated ' +
2845- 'and it won\'t be supported in the nearest future. ' +
2846- 'Instead, you should register your DataTable classes ' +
2847- 'using the following method Backendless.Data.mapTableToClass'
2848- )
2849-
2850- expect ( spyConsoleWarn ) . on . nth ( 1 ) . be . called . with ( warningMsg )
2851- expect ( spyConsoleWarn ) . on . nth ( 2 ) . be . called . with ( warningMsg )
2852- expect ( spyConsoleWarn ) . on . nth ( 3 ) . be . called . with ( warningMsg )
2853- expect ( spyConsoleWarn ) . on . nth ( 4 ) . be . called . with ( warningMsg )
2854- expect ( spyConsoleWarn ) . on . nth ( 5 ) . be . called . with ( warningMsg )
2855- expect ( spyConsoleWarn ) . on . nth ( 6 ) . be . called . with ( warningMsg )
2856-
2857- // eslint-disable-next-line no-console
2858- console . warn = _nativeConsoleWarn
2859- } )
2860-
28612797 it ( 'does not use classes from global for data store object with inner instances' , async ( ) => {
28622798 // eslint-disable-next-line no-console
28632799 const _nativeConsoleWarn = console . warn
28642800
28652801 // eslint-disable-next-line no-console
28662802 const spyConsoleWarn = console . warn = chai . spy ( )
28672803
2868- Backendless . useTableClassesFromGlobalScope = false
2869-
28702804 global . FooClass = class FooClass {
28712805 }
28722806
0 commit comments