Skip to content

Commit 0aef9ad

Browse files
feedback changes
1 parent c3ba2ce commit 0aef9ad

File tree

1 file changed

+17
-161
lines changed

1 file changed

+17
-161
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/data-storage.test.js

Lines changed: 17 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,6 @@ define([
3131
dataScope: 'magento'
3232
});
3333

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-
4834
it('Check returned value type if method called without arguments', function () {
4935
var type = typeof model.initConfig();
5036

@@ -70,20 +56,6 @@ define([
7056
dataScope: 'magento'
7157
});
7258

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-
8759
it('check returned type if method called with argument', function () {
8860
var ids = [1,2,3],
8961
type = typeof model.getByIds(ids);
@@ -98,7 +70,13 @@ define([
9870
});
9971

10072
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+
];
10280

10381
model = new DataStorage({
10482
dataScope: 'magento',
@@ -110,7 +88,7 @@ define([
11088
}
11189
});
11290

113-
expect(typeof model.getByIds(ids)).toEqual('object');
91+
expect(model.getByIds(ids)).toEqual(expectedValue);
11492
});
11593

11694
});
@@ -121,25 +99,15 @@ define([
12199
dataScope: 'magento'
122100
});
123101

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);
143111
});
144112

145113
});
@@ -150,28 +118,6 @@ define([
150118
dataScope: 'magento'
151119
});
152120

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-
175121
it('check returned type if method called with argument', function () {
176122
var params = {
177123
namespace: 'magento',
@@ -332,16 +278,6 @@ define([
332278
}
333279
});
334280

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-
345281
it('Check updateData has been called', function () {
346282
var data = [{
347283
id_field_name: 'entity_id',
@@ -357,16 +293,6 @@ define([
357293
dataScope: 'magento'
358294
});
359295

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-
370296
it('Check Ajax request', function () {
371297
var params = {
372298
namespace: 'magento',
@@ -401,16 +327,6 @@ define([
401327
dataScope: 'magento'
402328
});
403329

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-
414330
it('check "getRequest" has been executed', function () {
415331
var params = {
416332
namespace: 'magento',
@@ -434,16 +350,6 @@ define([
434350
dataScope: 'magento'
435351
});
436352

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-
447353
it('check "getRequestData" has been executed', function () {
448354
var request = {
449355
ids: [1,2,3]
@@ -495,16 +401,6 @@ define([
495401
dataScope: 'magento'
496402
});
497403

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-
508404
it('check "model._requests"', function () {
509405
var params = {
510406
namespace: 'magento',
@@ -559,16 +455,6 @@ define([
559455
dataScope: 'magento'
560456
});
561457

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-
572458
it('check "clearRequests" will empty _requests array', function () {
573459
var params = {
574460
namespace: 'magento',
@@ -600,16 +486,6 @@ define([
600486
dataScope: 'magento'
601487
});
602488

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-
613489
it('check "removeRequest" is defined', function () {
614490
var params = {
615491
namespace: 'magento',
@@ -634,16 +510,6 @@ define([
634510
dataScope: 'magento'
635511
});
636512

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-
647513
it('Return false if getRequest method returns false', function () {
648514
var params = {
649515
namespace: 'magento',
@@ -664,16 +530,6 @@ define([
664530
dataScope: 'magento'
665531
});
666532

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-
677533
it('Check "updateData" method has been called', function () {
678534
var data = {
679535
items: [{

0 commit comments

Comments
 (0)