@@ -31,20 +31,6 @@ define([
31
31
dataScope : 'magento'
32
32
} ) ;
33
33
34
- it ( 'Check for defined ' , function ( ) {
35
- expect ( model . hasOwnProperty ( 'initConfig' ) ) . toBeDefined ( ) ;
36
- } ) ;
37
-
38
- it ( 'Check method type' , function ( ) {
39
- var type = typeof model . initConfig ;
40
-
41
- expect ( type ) . toEqual ( 'function' ) ;
42
- } ) ;
43
-
44
- it ( 'Check returned value if method called without arguments' , function ( ) {
45
- expect ( model . initConfig ( ) ) . toBeDefined ( ) ;
46
- } ) ;
47
-
48
34
it ( 'Check returned value type if method called without arguments' , function ( ) {
49
35
var type = typeof model . initConfig ( ) ;
50
36
@@ -70,20 +56,6 @@ define([
70
56
dataScope : 'magento'
71
57
} ) ;
72
58
73
- it ( 'check for defined' , function ( ) {
74
- expect ( model . hasOwnProperty ( 'getByIds' ) ) . toBeDefined ( ) ;
75
- } ) ;
76
-
77
- it ( 'check method type' , function ( ) {
78
- expect ( typeof model . getByIds ) . toEqual ( 'function' ) ;
79
- } ) ;
80
-
81
- it ( 'Check returned value if method called with argument' , function ( ) {
82
- var ids = [ 1 , 2 , 3 ] ;
83
-
84
- expect ( model . getByIds ( ids ) ) . toBeDefined ( ) ;
85
- } ) ;
86
-
87
59
it ( 'check returned type if method called with argument' , function ( ) {
88
60
var ids = [ 1 , 2 , 3 ] ,
89
61
type = typeof model . getByIds ( ids ) ;
@@ -98,7 +70,13 @@ define([
98
70
} ) ;
99
71
100
72
it ( 'Return array if "getByIds" has been called' , function ( ) {
101
- var ids = [ 1 ] ;
73
+ var ids = [ 1 ] ,
74
+ expectedValue = [
75
+ {
76
+ id_field_name : 'entity_id' ,
77
+ entity_id : '1'
78
+ }
79
+ ] ;
102
80
103
81
model = new DataStorage ( {
104
82
dataScope : 'magento' ,
@@ -110,7 +88,7 @@ define([
110
88
}
111
89
} ) ;
112
90
113
- expect ( typeof model . getByIds ( ids ) ) . toEqual ( 'object' ) ;
91
+ expect ( model . getByIds ( ids ) ) . toEqual ( expectedValue ) ;
114
92
} ) ;
115
93
116
94
} ) ;
@@ -121,25 +99,15 @@ define([
121
99
dataScope : 'magento'
122
100
} ) ;
123
101
124
- it ( 'check for defined' , function ( ) {
125
- expect ( model . hasOwnProperty ( 'getIds' ) ) . toBeDefined ( ) ;
126
- } ) ;
127
-
128
- it ( 'check method type' , function ( ) {
129
- expect ( typeof model . getIds ) . toEqual ( 'function' ) ;
130
- } ) ;
131
-
132
- it ( 'check returned value if method called with argument' , function ( ) {
133
- var ids = [ 1 , 2 , 3 ] ;
134
-
135
- expect ( model . getIds ( ids ) ) . toBeDefined ( ) ;
136
- } ) ;
137
-
138
- it ( 'check returned type if method called with argument' , function ( ) {
139
- var ids = [ 1 , 2 , 3 ] ,
140
- type = typeof model . getIds ( ids ) ;
141
-
142
- expect ( type ) . toEqual ( 'object' ) ;
102
+ it ( 'check array of entity_id will return' , function ( ) {
103
+ var ids = [
104
+ {
105
+ id_field_name : 'entity_id' ,
106
+ entity_id : '1'
107
+ }
108
+ ] ,
109
+ expectedValue = [ '1' ] ;
110
+ expect ( model . getIds ( ids ) ) . toEqual ( expectedValue ) ;
143
111
} ) ;
144
112
145
113
} ) ;
@@ -150,28 +118,6 @@ define([
150
118
dataScope : 'magento'
151
119
} ) ;
152
120
153
- it ( 'check for defined' , function ( ) {
154
- expect ( model . hasOwnProperty ( 'getData' ) ) . toBeDefined ( ) ;
155
- } ) ;
156
-
157
- it ( 'check method type' , function ( ) {
158
- expect ( typeof model . getData ) . toEqual ( 'function' ) ;
159
- } ) ;
160
-
161
- it ( 'check returned value if method called with argument' , function ( ) {
162
- var params = {
163
- namespace : 'magento' ,
164
- search : '' ,
165
- filters : {
166
- store_id : 0
167
- } ,
168
- sorting : { } ,
169
- paging : { }
170
- } ;
171
-
172
- expect ( model . getData ( params ) ) . toBeDefined ( ) ;
173
- } ) ;
174
-
175
121
it ( 'check returned type if method called with argument' , function ( ) {
176
122
var params = {
177
123
namespace : 'magento' ,
@@ -332,16 +278,6 @@ define([
332
278
}
333
279
} ) ;
334
280
335
- it ( 'Check for defined ' , function ( ) {
336
- expect ( model . hasOwnProperty ( 'updateData' ) ) . toBeDefined ( ) ;
337
- } ) ;
338
-
339
- it ( 'Check method type' , function ( ) {
340
- var type = typeof model . updateData ;
341
-
342
- expect ( type ) . toEqual ( 'function' ) ;
343
- } ) ;
344
-
345
281
it ( 'Check updateData has been called' , function ( ) {
346
282
var data = [ {
347
283
id_field_name : 'entity_id' ,
@@ -357,16 +293,6 @@ define([
357
293
dataScope : 'magento'
358
294
} ) ;
359
295
360
- it ( 'Check for defined' , function ( ) {
361
- expect ( model . hasOwnProperty ( 'requestData' ) ) . toBeDefined ( ) ;
362
- } ) ;
363
-
364
- it ( 'Check method type' , function ( ) {
365
- var type = typeof model . requestData ;
366
-
367
- expect ( type ) . toEqual ( 'function' ) ;
368
- } ) ;
369
-
370
296
it ( 'Check Ajax request' , function ( ) {
371
297
var params = {
372
298
namespace : 'magento' ,
@@ -401,16 +327,6 @@ define([
401
327
dataScope : 'magento'
402
328
} ) ;
403
329
404
- it ( 'Check for defined' , function ( ) {
405
- expect ( model . hasOwnProperty ( 'getRequest' ) ) . toBeDefined ( ) ;
406
- } ) ;
407
-
408
- it ( 'Check method' , function ( ) {
409
- var type = typeof model . getRequest ;
410
-
411
- expect ( type ) . toEqual ( 'function' ) ;
412
- } ) ;
413
-
414
330
it ( 'check "getRequest" has been executed' , function ( ) {
415
331
var params = {
416
332
namespace : 'magento' ,
@@ -434,16 +350,6 @@ define([
434
350
dataScope : 'magento'
435
351
} ) ;
436
352
437
- it ( 'Check for defined ' , function ( ) {
438
- expect ( model . hasOwnProperty ( 'getRequestData' ) ) . toBeDefined ( ) ;
439
- } ) ;
440
-
441
- it ( 'Check method type' , function ( ) {
442
- var type = typeof model . getRequestData ;
443
-
444
- expect ( type ) . toEqual ( 'function' ) ;
445
- } ) ;
446
-
447
353
it ( 'check "getRequestData" has been executed' , function ( ) {
448
354
var request = {
449
355
ids : [ 1 , 2 , 3 ]
@@ -495,16 +401,6 @@ define([
495
401
dataScope : 'magento'
496
402
} ) ;
497
403
498
- it ( 'Check for defined ' , function ( ) {
499
- expect ( model . hasOwnProperty ( 'cacheRequest' ) ) . toBeDefined ( ) ;
500
- } ) ;
501
-
502
- it ( 'Check method type' , function ( ) {
503
- var type = typeof model . cacheRequest ;
504
-
505
- expect ( type ) . toEqual ( 'function' ) ;
506
- } ) ;
507
-
508
404
it ( 'check "model._requests"' , function ( ) {
509
405
var params = {
510
406
namespace : 'magento' ,
@@ -559,16 +455,6 @@ define([
559
455
dataScope : 'magento'
560
456
} ) ;
561
457
562
- it ( 'Check for defined ' , function ( ) {
563
- expect ( model . hasOwnProperty ( 'clearRequests' ) ) . toBeDefined ( ) ;
564
- } ) ;
565
-
566
- it ( 'Check method type' , function ( ) {
567
- var type = typeof model . clearRequests ;
568
-
569
- expect ( type ) . toEqual ( 'function' ) ;
570
- } ) ;
571
-
572
458
it ( 'check "clearRequests" will empty _requests array' , function ( ) {
573
459
var params = {
574
460
namespace : 'magento' ,
@@ -600,16 +486,6 @@ define([
600
486
dataScope : 'magento'
601
487
} ) ;
602
488
603
- it ( 'Check for defined ' , function ( ) {
604
- expect ( model . hasOwnProperty ( 'removeRequest' ) ) . toBeDefined ( ) ;
605
- } ) ;
606
-
607
- it ( 'Check method type' , function ( ) {
608
- var type = typeof model . removeRequest ;
609
-
610
- expect ( type ) . toEqual ( 'function' ) ;
611
- } ) ;
612
-
613
489
it ( 'check "removeRequest" is defined' , function ( ) {
614
490
var params = {
615
491
namespace : 'magento' ,
@@ -634,16 +510,6 @@ define([
634
510
dataScope : 'magento'
635
511
} ) ;
636
512
637
- it ( 'Check for defined ' , function ( ) {
638
- expect ( model . hasOwnProperty ( 'wasRequested' ) ) . toBeDefined ( ) ;
639
- } ) ;
640
-
641
- it ( 'Check method type' , function ( ) {
642
- var type = typeof model . wasRequested ;
643
-
644
- expect ( type ) . toEqual ( 'function' ) ;
645
- } ) ;
646
-
647
513
it ( 'Return false if getRequest method returns false' , function ( ) {
648
514
var params = {
649
515
namespace : 'magento' ,
@@ -664,16 +530,6 @@ define([
664
530
dataScope : 'magento'
665
531
} ) ;
666
532
667
- it ( 'Check for defined ' , function ( ) {
668
- expect ( model . hasOwnProperty ( 'onRequestComplete' ) ) . toBeDefined ( ) ;
669
- } ) ;
670
-
671
- it ( 'Check method type' , function ( ) {
672
- var type = typeof model . onRequestComplete ;
673
-
674
- expect ( type ) . toEqual ( 'function' ) ;
675
- } ) ;
676
-
677
533
it ( 'Check "updateData" method has been called' , function ( ) {
678
534
var data = {
679
535
items : [ {
0 commit comments