|
16 | 16 | return cb(executeSql); |
17 | 17 | }, |
18 | 18 | }; |
19 | | - let datas = null; |
20 | | - let backupDatas = null; |
| 19 | + let data = null; |
| 20 | + let backupData = null; |
21 | 21 |
|
22 | 22 | // load the controller's module |
23 | 23 | beforeEach(() => { |
24 | | - datas = [ |
| 24 | + data = [ |
25 | 25 | { |
26 | 26 | id: 1, |
27 | 27 | test: 'test1', |
|
48 | 48 | }, |
49 | 49 | }, |
50 | 50 | ].map(data => angular.toJson(data)); |
51 | | - backupDatas = { |
| 51 | + backupData = { |
52 | 52 | rows: { |
53 | | - item: i => ({ payload: datas[i] }), |
54 | | - length: datas.length, |
| 53 | + item: i => ({ payload: data[i] }), |
| 54 | + length: data.length, |
55 | 55 | }, |
56 | 56 | }; |
57 | 57 |
|
|
99 | 99 | // |
100 | 100 | // --------------- |
101 | 101 | describe('#listBackUp()', () => { |
102 | | - it('should failed to list Backup datas', inject(( |
| 102 | + it('should failed to list Backup data', inject(( |
103 | 103 | $q, |
104 | 104 | $timeout, |
105 | 105 | $exceptionHandler |
|
118 | 118 | expect($exceptionHandler.errors).lengthOf(1); |
119 | 119 | })); |
120 | 120 |
|
121 | | - it('should list Backup datas', inject(($q, $timeout) => { |
| 121 | + it('should list Backup data', inject(($q, $timeout) => { |
122 | 122 | var data; |
123 | 123 |
|
124 | | - executeStub.yields('test', backupDatas); |
| 124 | + executeStub.yields('test', backupData); |
125 | 125 |
|
126 | 126 | backUp.listBackUp({ limit: 10, offset: 10 }).then(_data_ => { |
127 | 127 | data = _data_; |
|
183 | 183 | it('should get Backup data', inject(($q, $timeout) => { |
184 | 184 | var data; |
185 | 185 |
|
186 | | - executeStub.yields('test', backupDatas); |
| 186 | + executeStub.yields('test', backupData); |
187 | 187 |
|
188 | 188 | backUp.getBackUp(1).then(_data_ => { |
189 | 189 | data = _data_; |
|
206 | 206 | // --------------- |
207 | 207 | describe('#queryBackUp()', () => { |
208 | 208 | describe('without data', () => { |
209 | | - it('should failed to query Backup datas', inject(( |
| 209 | + it('should failed to query Backup data', inject(( |
210 | 210 | $q, |
211 | 211 | $timeout, |
212 | 212 | $exceptionHandler |
|
220 | 220 | })); |
221 | 221 | }); |
222 | 222 | describe('with indexed fields', () => { |
223 | | - it('should query Backup datas', inject(($q, $timeout) => { |
| 223 | + it('should query Backup data', inject(($q, $timeout) => { |
224 | 224 | var data; |
225 | | - const fakeDatas = [ |
| 225 | + const fakeData = [ |
226 | 226 | { |
227 | 227 | id: 1, |
228 | 228 | test: 'test1', |
|
238 | 238 |
|
239 | 239 | executeStub.yields('test', { |
240 | 240 | rows: { |
241 | | - item: i => ({ payload: fakeDatas[i] }), |
242 | | - length: fakeDatas.length, |
| 241 | + item: i => ({ payload: fakeData[i] }), |
| 242 | + length: fakeData.length, |
243 | 243 | }, |
244 | 244 | }); |
245 | 245 |
|
|
266 | 266 | expect(data[0].id).equal(1); |
267 | 267 | })); |
268 | 268 |
|
269 | | - it('should query Backup datas with sort', inject(($q, $timeout) => { |
| 269 | + it('should query Backup data with sort', inject(($q, $timeout) => { |
270 | 270 | let data; |
271 | 271 |
|
272 | 272 | function dbInstance() { |
|
275 | 275 | backUp = new SqlQueryService('test', dbInstance, { |
276 | 276 | indexed_fields: ['test'], |
277 | 277 | }); |
278 | | - executeStub.yields('test', backupDatas); |
| 278 | + executeStub.yields('test', backupData); |
279 | 279 |
|
280 | 280 | // Common param |
281 | 281 | backUp |
|
302 | 302 | expect(data[0].id).equal(1); |
303 | 303 | })); |
304 | 304 |
|
305 | | - it('should query Backup datas with sort desc', inject(( |
306 | | - $q, |
307 | | - $timeout |
308 | | - ) => { |
| 305 | + it('should query Backup data with sort desc', inject(($q, $timeout) => { |
309 | 306 | function dbInstance() { |
310 | 307 | return $q.when(sqlInstance); |
311 | 308 | } |
312 | 309 | backUp = new SqlQueryService('test', dbInstance, { |
313 | 310 | indexed_fields: ['test'], |
314 | 311 | }); |
315 | | - executeStub.yields('test', backupDatas); |
| 312 | + executeStub.yields('test', backupData); |
316 | 313 |
|
317 | 314 | // Common param |
318 | 315 | backUp |
|
332 | 329 | ); |
333 | 330 | })); |
334 | 331 |
|
335 | | - it('should query Backup datas with multiple sort keys', inject(( |
| 332 | + it('should query Backup data with multiple sort keys', inject(( |
336 | 333 | $q, |
337 | 334 | $timeout |
338 | 335 | ) => { |
|
342 | 339 | backUp = new SqlQueryService('test', dbInstance, { |
343 | 340 | indexed_fields: ['test'], |
344 | 341 | }); |
345 | | - executeStub.yields('test', backupDatas); |
| 342 | + executeStub.yields('test', backupData); |
346 | 343 |
|
347 | 344 | // With 2 sort keys |
348 | 345 | backUp.queryBackUp( |
|
360 | 357 | ); |
361 | 358 | })); |
362 | 359 |
|
363 | | - it('should query Backup datas with multiple indexed fields', inject(( |
| 360 | + it('should query Backup data with multiple indexed fields', inject(( |
364 | 361 | $q, |
365 | 362 | $timeout |
366 | 363 | ) => { |
|
373 | 370 | indexed_fields: ['test', 'test2', 'test3'], |
374 | 371 | }); |
375 | 372 |
|
376 | | - executeStub.yields('test', backupDatas); |
| 373 | + executeStub.yields('test', backupData); |
377 | 374 |
|
378 | 375 | backUp |
379 | 376 | .queryBackUp({ |
|
402 | 399 | expect(data).lengthOf(1); |
403 | 400 | })); |
404 | 401 |
|
405 | | - it('should query Backup with a large number of datas', inject(( |
| 402 | + it('should query Backup with a large number of data', inject(( |
406 | 403 | $q, |
407 | 404 | $timeout |
408 | 405 | ) => { |
|
425 | 422 | indexed_fields: ['test', 'test2', 'test3'], |
426 | 423 | }); |
427 | 424 |
|
428 | | - executeStub.returns($q.when(backupDatas)); |
| 425 | + executeStub.returns($q.when(backupData)); |
429 | 426 |
|
430 | 427 | for (let i = 0; 1010 > i; i++) { |
431 | 428 | params.push(i + 1); |
|
474 | 471 | })); |
475 | 472 | }); |
476 | 473 | describe('with non indexed fields', () => { |
477 | | - it('should query Backup datas', inject($timeout => { |
| 474 | + it('should query Backup data', inject($timeout => { |
478 | 475 | var data; |
479 | 476 |
|
480 | | - executeStub.yields('test', backupDatas); |
| 477 | + executeStub.yields('test', backupData); |
481 | 478 |
|
482 | 479 | // Common param |
483 | 480 | backUp |
|
503 | 500 | it('should perform limit in memory', inject($timeout => { |
504 | 501 | var data; |
505 | 502 |
|
506 | | - executeStub.yields('test', backupDatas); |
| 503 | + executeStub.yields('test', backupData); |
507 | 504 |
|
508 | 505 | // Common param |
509 | 506 | backUp |
|
591 | 588 | data = null; |
592 | 589 | }); |
593 | 590 |
|
594 | | - it('should failed to update Backup datas', inject(( |
| 591 | + it('should failed to update Backup data', inject(( |
595 | 592 | $q, |
596 | 593 | $timeout, |
597 | 594 | $exceptionHandler |
|
608 | 605 | expect(data).equal(null); |
609 | 606 | })); |
610 | 607 |
|
611 | | - it('should succeed to update Backup datas', inject(($q, $timeout) => { |
| 608 | + it('should succeed to update Backup data', inject(($q, $timeout) => { |
612 | 609 | executeStub.yields('test', 'ok'); |
613 | 610 |
|
614 | 611 | backUp.updateBackUp(dataUpdate).then(_data_ => { |
|
624 | 621 | expect(data).equal(dataUpdate); |
625 | 622 | })); |
626 | 623 |
|
627 | | - it('should succeed to update Backup datas with indexed fields', inject(( |
| 624 | + it('should succeed to update Backup data with indexed fields', inject(( |
628 | 625 | $q, |
629 | 626 | $timeout |
630 | 627 | ) => { |
|
660 | 657 | // |
661 | 658 | // --------------- |
662 | 659 | describe('#removeBackUp()', () => { |
663 | | - it('should failed to remove Backup datas', inject(( |
| 660 | + it('should failed to remove Backup data', inject(( |
664 | 661 | $q, |
665 | 662 | $timeout, |
666 | 663 | $exceptionHandler |
|
679 | 676 | expect(err).equal(null); |
680 | 677 | })); |
681 | 678 |
|
682 | | - it('should succeed to remove Backup datas', inject(($q, $timeout) => { |
| 679 | + it('should succeed to remove Backup data', inject(($q, $timeout) => { |
683 | 680 | var data; |
684 | 681 |
|
685 | 682 | executeStub.yields('test', 'ok'); |
|
699 | 696 | }); |
700 | 697 |
|
701 | 698 | describe('#removeQueryBackUp()', () => { |
702 | | - it('should failed to remove Backup datas', inject(( |
| 699 | + it('should failed to remove Backup data', inject(( |
703 | 700 | $q, |
704 | 701 | $timeout, |
705 | 702 | $exceptionHandler |
|
722 | 719 | expect(err).equal(null); |
723 | 720 | })); |
724 | 721 |
|
725 | | - it('should succeed to remove Backup datas', inject(($q, $timeout) => { |
| 722 | + it('should succeed to remove Backup data', inject(($q, $timeout) => { |
726 | 723 | var data; |
727 | 724 |
|
728 | 725 | executeStub.yields('test', 'ok'); |
|
783 | 780 | expect(data).equal({}.undef); |
784 | 781 | })); |
785 | 782 |
|
786 | | - it('should delete datas', inject(($q, $timeout) => { |
| 783 | + it('should delete data', inject(($q, $timeout) => { |
787 | 784 | var data; |
788 | 785 |
|
789 | 786 | executeStub.yields('test', 'ok'); |
|
802 | 799 | expect(data).deep.equal(['ok']); |
803 | 800 | })); |
804 | 801 |
|
805 | | - it('should modify datas', inject(($q, $timeout) => { |
| 802 | + it('should modify data', inject(($q, $timeout) => { |
806 | 803 | var data; |
807 | 804 |
|
808 | 805 | executeStub.yields('test', 'ok'); |
|
821 | 818 | expect(data).deep.equal(['ok']); |
822 | 819 | })); |
823 | 820 |
|
824 | | - it('should modify and delete datas', inject(($q, $timeout) => { |
| 821 | + it('should modify and delete data', inject(($q, $timeout) => { |
825 | 822 | var data; |
826 | 823 |
|
827 | 824 | executeStub.yields('test', 'ok'); |
|
853 | 850 | expect(data).deep.equal(['ok', 'ok']); |
854 | 851 | })); |
855 | 852 |
|
856 | | - it('should modify and delete datas whith indexed fields', inject(( |
| 853 | + it('should modify and delete data whith indexed fields', inject(( |
857 | 854 | $q, |
858 | 855 | $timeout |
859 | 856 | ) => { |
|
0 commit comments