linear_time_test.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. require('views/common/chart/linear_time');
  20. var testHelpers = require('test/helpers');
  21. describe('App.ChartLinearTimeView', function () {
  22. var chartLinearTimeView;
  23. beforeEach(function() {
  24. chartLinearTimeView = App.ChartLinearTimeView.create();
  25. });
  26. describe("#isRequestRunning", function () {
  27. it("isPopup true, running request", function() {
  28. chartLinearTimeView.setProperties({
  29. isPopup: true,
  30. runningPopupRequests: [{
  31. ajaxIndex: 'req1'
  32. }],
  33. ajaxIndex: 'req1'
  34. });
  35. chartLinearTimeView.propertyDidChange('isRequestRunning');
  36. expect(chartLinearTimeView.get('isRequestRunning')).to.be.true;
  37. });
  38. it("isPopup false, running request", function() {
  39. chartLinearTimeView.setProperties({
  40. isPopup: false,
  41. runningRequests: [{
  42. ajaxIndex: 'req1'
  43. }],
  44. ajaxIndex: 'req1'
  45. });
  46. chartLinearTimeView.propertyDidChange('isRequestRunning');
  47. expect(chartLinearTimeView.get('isRequestRunning')).to.be.true;
  48. });
  49. it("isPopup false, no running request", function() {
  50. chartLinearTimeView.setProperties({
  51. isPopup: false,
  52. runningRequests: [],
  53. ajaxIndex: 'req1'
  54. });
  55. chartLinearTimeView.propertyDidChange('isRequestRunning');
  56. expect(chartLinearTimeView.get('isRequestRunning')).to.be.false;
  57. });
  58. it("isPopup true, no running request", function() {
  59. chartLinearTimeView.setProperties({
  60. isPopup: true,
  61. runningPopupRequests: [],
  62. ajaxIndex: 'req1'
  63. });
  64. chartLinearTimeView.propertyDidChange('isRequestRunning');
  65. expect(chartLinearTimeView.get('isRequestRunning')).to.be.false;
  66. });
  67. });
  68. describe('#transformData', function () {
  69. var result;
  70. var data = [[1, 1200000000], [2, 1200000000], [3, 1200000000]];
  71. var name = 'abc';
  72. beforeEach(function () {
  73. sinon.stub(App.router, 'get').withArgs('userSettingsController.userSettings.timezone').returns('(UTC+00:00) Greenwich');
  74. sinon.stub(App, 'dateTimeWithTimeZone').returns(1);
  75. });
  76. afterEach(function () {
  77. App.router.get.restore();
  78. App.dateTimeWithTimeZone.restore();
  79. });
  80. it('"name" should be "abc" ', function () {
  81. result = chartLinearTimeView.transformData(data, name);
  82. expect(result.name).to.equal('abc');
  83. });
  84. it('data size should be 3 ', function () {
  85. result = chartLinearTimeView.transformData(data, name);
  86. expect(result.data.length).to.equal(3);
  87. });
  88. it('data[0].y should be 1 ', function () {
  89. result = chartLinearTimeView.transformData(data, name);
  90. expect(result.data[0].y).to.equal(1);
  91. })
  92. });
  93. describe('#yAxisFormatter', function() {
  94. var tests = [
  95. {m:'undefined to 0',i:undefined,e:0},
  96. {m:'NaN to 0',i:NaN,e:0},
  97. {m:'0 to 0',i:'0',e:'0'},
  98. {m:'1000 to 1K',i:'1000',e:'1K'},
  99. {m:'1000000 to 1M',i:'1000000',e:'1M'},
  100. {m:'1000000000 to 1B',i:'1000000000',e:'1B'},
  101. {m:'1000000000000 to 1T',i:'1000000000000',e:'1T'},
  102. {m:'1048576 to 1.049M',i:'1048576',e:'1.049M'},
  103. {m:'1073741824 to 1.074B',i:'1073741824',e:'1.074B'}
  104. ];
  105. tests.forEach(function(test) {
  106. it(test.m + ' ', function () {
  107. expect(chartLinearTimeView.yAxisFormatter(test.i)).to.equal(test.e);
  108. });
  109. });
  110. });
  111. describe('#checkSeries', function() {
  112. var tests = [
  113. {m:'undefined - false',i:undefined,e:false},
  114. {m:'NaN - false',i:NaN,e:false},
  115. {m:'object without data property - false',i:[{}],e:false},
  116. {m:'object with empty data property - false',i:[{data:[]}],e:false},
  117. {m:'object with invalid data property - false',i:[{data:[1]}],e:false},
  118. {m:'object with valid data property - true',i:[{data:[{x:1,y:1},{x:2,y:2}]}],e:true}
  119. ];
  120. tests.forEach(function(test) {
  121. it(test.m + ' ', function () {
  122. expect(chartLinearTimeView.checkSeries(test.i)).to.equal(test.e);
  123. });
  124. });
  125. });
  126. describe('#BytesFormatter', function() {
  127. var tests = [
  128. {m:'undefined to "0 B"',i:undefined,e:'0 B'},
  129. {m:'NaN to "0 B"',i:NaN,e:'0 B'},
  130. {m:'0 to "0 B"',i:0,e:'0 B'},
  131. {m:'124 to "124 B"',i:124,e:'124 B'},
  132. {m:'1024 to "1 KB"',i:1024,e:'1 KB'},
  133. {m:'1536 to "1 KB"',i:1536,e:'1.5 KB'},
  134. {m:'1048576 to "1 MB"',i:1048576,e:'1 MB'},
  135. {m:'1073741824 to "1 GB"',i:1073741824,e:'1 GB'},
  136. {m:'1610612736 to "1.5 GB"',i:1610612736,e:'1.5 GB'}
  137. ];
  138. tests.forEach(function(test) {
  139. it(test.m + ' ', function () {
  140. expect(App.ChartLinearTimeView.BytesFormatter(test.i)).to.equal(test.e);
  141. });
  142. });
  143. });
  144. describe('#PercentageFormatter', function() {
  145. var tests = [
  146. {m:'undefined to "0 %"',i:undefined,e:'0 %'},
  147. {m:'NaN to "0 %"',i:NaN,e:'0 %'},
  148. {m:'0 to "0 %"',i:0,e:'0 %'},
  149. {m:'1 to "1%"',i:1,e:'1%'},
  150. {m:'1.12341234 to "1.123%"',i:1.12341234,e:'1.123%'},
  151. {m:'-11 to "-11%"',i:-11,e:'-11%'},
  152. {m:'-11.12341234 to "-11.123%"',i:-11.12341234,e:'-11.123%'}
  153. ];
  154. tests.forEach(function(test) {
  155. it(test.m + ' ', function () {
  156. expect(App.ChartLinearTimeView.PercentageFormatter(test.i)).to.equal(test.e);
  157. });
  158. });
  159. });
  160. describe('#TimeElapsedFormatter', function() {
  161. var tests = [
  162. {m:'undefined to "0 ms"',i:undefined,e:'0 ms'},
  163. {m:'NaN to "0 ms"',i:NaN,e:'0 ms'},
  164. {m:'0 to "0 ms"',i:0,e:'0 ms'},
  165. {m:'1000 to "1000 ms"',i:1000,e:'1000 ms'},
  166. {m:'120000 to "2 m"',i:120000,e:'2 m'},
  167. {m:'3600000 to "60 m"',i:3600000,e:'60 m'},
  168. {m:'5000000 to "1 hr"',i:5000000,e:'1 hr'},
  169. {m:'7200000 to "2 hr"',i:7200000,e:'2 hr'},
  170. {m:'90000000 to "1 d"',i:90000000,e:'1 d'}
  171. ];
  172. tests.forEach(function(test) {
  173. it(test.m + ' ', function () {
  174. expect(App.ChartLinearTimeView.TimeElapsedFormatter(test.i)).to.equal(test.e);
  175. });
  176. });
  177. });
  178. describe("#getDataForAjaxRequest()", function() {
  179. var services = {
  180. yarnService: [],
  181. hdfsService: []
  182. };
  183. var rangeCases = [
  184. {
  185. currentTimeIndex: 0,
  186. customStartTime: 100000,
  187. customEndTime: 200000,
  188. fromSeconds: -3599,
  189. toSeconds: 1,
  190. title: 'preset time range'
  191. },
  192. {
  193. currentTimeIndex: 8,
  194. customStartTime: 100000,
  195. customEndTime: 200000,
  196. fromSeconds: 100,
  197. toSeconds: 200,
  198. title: 'custom time range'
  199. },
  200. {
  201. currentTimeIndex: 8,
  202. customStartTime: null,
  203. customEndTime: null,
  204. fromSeconds: -3599,
  205. toSeconds: 1,
  206. title: 'custom time range, no boundaries set'
  207. }
  208. ];
  209. beforeEach(function(){
  210. sinon.stub(App.HDFSService, 'find', function(){return services.hdfsService});
  211. sinon.stub(App.YARNService, 'find', function(){return services.yarnService});
  212. sinon.stub(App, 'dateTime').returns(1000);
  213. chartLinearTimeView.set('content', null);
  214. });
  215. afterEach(function(){
  216. App.HDFSService.find.restore();
  217. App.YARNService.find.restore();
  218. App.dateTime.restore();
  219. });
  220. it("content has hostName", function() {
  221. chartLinearTimeView.set('content', Em.Object.create({
  222. hostName: 'host1'
  223. }));
  224. expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
  225. toSeconds: 1,
  226. fromSeconds: -3599,
  227. stepSeconds: 15,
  228. hostName: 'host1',
  229. nameNodeName: '',
  230. resourceManager: ''
  231. });
  232. });
  233. it("get Namenode host", function() {
  234. services.hdfsService = [
  235. Em.Object.create({
  236. nameNode: {hostName: 'host1'}
  237. })
  238. ];
  239. expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
  240. toSeconds: 1,
  241. fromSeconds: -3599,
  242. stepSeconds: 15,
  243. hostName: '',
  244. nameNodeName: 'host1',
  245. resourceManager: ''
  246. });
  247. services.hdfsService = [];
  248. });
  249. it("get Namenode host HA", function() {
  250. services.hdfsService = [
  251. Em.Object.create({
  252. activeNameNode: {hostName: 'host1'}
  253. })
  254. ];
  255. expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
  256. toSeconds: 1,
  257. fromSeconds: -3599,
  258. stepSeconds: 15,
  259. hostName: '',
  260. nameNodeName: 'host1',
  261. resourceManager: ''
  262. });
  263. services.hdfsService = [];
  264. });
  265. it("get resourceManager host", function() {
  266. services.yarnService = [
  267. Em.Object.create({
  268. resourceManager: {hostName: 'host1'}
  269. })
  270. ];
  271. expect(chartLinearTimeView.getDataForAjaxRequest()).to.be.eql({
  272. toSeconds: 1,
  273. fromSeconds: -3599,
  274. stepSeconds: 15,
  275. hostName: '',
  276. nameNodeName: '',
  277. resourceManager: 'host1'
  278. });
  279. services.yarnService = [];
  280. });
  281. rangeCases.forEach(function (item) {
  282. it(item.title, function () {
  283. chartLinearTimeView.setProperties({
  284. currentTimeIndex: item.currentTimeIndex,
  285. customStartTime: item.customStartTime,
  286. customEndTime: item.customEndTime,
  287. timeUnitSeconds: 3600
  288. });
  289. var requestData = Em.Object.create(chartLinearTimeView.getDataForAjaxRequest());
  290. expect(requestData.getProperties(['fromSeconds', 'toSeconds'])).to.eql({
  291. fromSeconds: item.fromSeconds,
  292. toSeconds: item.toSeconds
  293. });
  294. });
  295. });
  296. });
  297. describe('#setCurrentTimeIndexFromParent', function () {
  298. var view,
  299. cases = [
  300. {
  301. parent: 1,
  302. child: 2,
  303. result: 2,
  304. title: 'child and parent have currentTimeRangeIndex'
  305. },
  306. {
  307. parent: undefined,
  308. child: 2,
  309. result: 2,
  310. title: 'only child has currentTimeRangeIndex'
  311. },
  312. {
  313. parent: 1,
  314. child: undefined,
  315. result: 1,
  316. title: 'only parent has currentTimeRangeIndex'
  317. }
  318. ],
  319. isReadyCases = [
  320. {
  321. inWidget: true,
  322. isClusterMetricsWidget: true,
  323. parentViewIsLoaded: true,
  324. isReady: false,
  325. title: 'cluster metrics widget'
  326. },
  327. {
  328. inWidget: true,
  329. isClusterMetricsWidget: false,
  330. parentViewIsLoaded: false,
  331. isReady: true,
  332. title: 'enhanced service widget'
  333. },
  334. {
  335. inWidget: false,
  336. isClusterMetricsWidget: false,
  337. parentViewIsLoaded: true,
  338. isReady: false,
  339. title: 'non-widget graph'
  340. }
  341. ];
  342. beforeEach(function () {
  343. view = App.ChartLinearTimeView.create({
  344. isReady: true,
  345. controller: {},
  346. parentView: Em.Object.create({
  347. currentTimeRangeIndex: 1,
  348. isLoaded: true,
  349. parentView: Em.Object.create({
  350. currentTimeRangeIndex: 2
  351. })
  352. }),
  353. timeUnitSecondsSetter: Em.K
  354. });
  355. });
  356. cases.forEach(function (item) {
  357. it(item.title, function () {
  358. view.set('parentView.currentTimeRangeIndex', item.child);
  359. view.set('parentView.parentView.currentTimeRangeIndex', item.parent);
  360. view.propertyDidChange('parentView.currentTimeRangeIndex');
  361. expect(view.get('currentTimeIndex')).to.equal(item.result);
  362. });
  363. });
  364. isReadyCases.forEach(function (item) {
  365. describe(item.title, function () {
  366. beforeEach(function () {
  367. sinon.stub(App.ajax, 'abortRequests', Em.K);
  368. view.set('inWidget', item.inWidget);
  369. view.set('parentView.isClusterMetricsWidget', item.isClusterMetricsWidget);
  370. view.propertyDidChange('parentView.currentTimeRangeIndex');
  371. });
  372. afterEach(function () {
  373. App.ajax.abortRequests.restore();
  374. });
  375. it('parentView.isLoaded', function () {
  376. expect(view.get('parentView.isLoaded')).to.eql(item.parentViewIsLoaded);
  377. });
  378. it('isReady', function () {
  379. expect(view.get('isReady')).to.eql(item.isReady);
  380. });
  381. });
  382. });
  383. });
  384. describe('#loadDataSuccessCallback', function () {
  385. beforeEach(function () {
  386. sinon.stub(chartLinearTimeView, '_refreshGraph', Em.K);
  387. });
  388. afterEach(function () {
  389. chartLinearTimeView._refreshGraph.restore();
  390. });
  391. it('should refresh graph', function () {
  392. var response = {
  393. key: 'value'
  394. };
  395. chartLinearTimeView.loadDataSuccessCallback(response);
  396. expect(chartLinearTimeView._refreshGraph.calledOnce).to.be.true;
  397. expect(chartLinearTimeView._refreshGraph.calledWith(response)).to.be.true;
  398. });
  399. });
  400. describe('#setYAxisFormatter', function () {
  401. var view,
  402. cases = [
  403. {
  404. displayUnit: '%',
  405. formatter: 'PercentageFormatter'
  406. },
  407. {
  408. displayUnit: 'B',
  409. formatter: 'BytesFormatter'
  410. },
  411. {
  412. displayUnit: 'ms',
  413. formatter: 'TimeElapsedFormatter'
  414. },
  415. {
  416. displayUnit: 'kg',
  417. formatter: 'DefaultFormatter',
  418. title: 'other display unit'
  419. },
  420. {
  421. formatter: 'DefaultFormatter',
  422. title: 'no display unit'
  423. }
  424. ],
  425. methodNames = ['PercentageFormatter', 'CreateRateFormatter', 'BytesFormatter', 'TimeElapsedFormatter', 'DefaultFormatter'];
  426. beforeEach(function () {
  427. view = App.ChartLinearTimeView.create();
  428. methodNames.forEach(function (name) {
  429. sinon.stub(App.ChartLinearTimeView, name, Em.K);
  430. });
  431. });
  432. afterEach(function () {
  433. methodNames.forEach(function (name) {
  434. App.ChartLinearTimeView[name].restore();
  435. });
  436. });
  437. cases.forEach(function (item) {
  438. describe(item.title || item.displayUnit, function () {
  439. beforeEach(function () {
  440. view.set('displayUnit', item.displayUnit);
  441. view.setYAxisFormatter();
  442. view.yAxisFormatter();
  443. });
  444. methodNames.forEach(function (name) {
  445. it(name, function () {
  446. expect(App.ChartLinearTimeView[name].callCount).to.equal(Number(name === item.formatter));
  447. });
  448. });
  449. });
  450. });
  451. });
  452. describe('#localeTimeUnit', function () {
  453. var cases = [
  454. {
  455. timeUnitSeconds: 240,
  456. localeTimeUnit: '1 minute'
  457. },
  458. {
  459. timeUnitSeconds: 172788,
  460. localeTimeUnit: '719.95 minute'
  461. },
  462. {
  463. timeUnitSeconds: 172800,
  464. localeTimeUnit: 'day'
  465. },
  466. {
  467. timeUnitSeconds: 1209599,
  468. localeTimeUnit: 'day'
  469. },
  470. {
  471. timeUnitSeconds: 1209600,
  472. localeTimeUnit: 'week'
  473. },
  474. {
  475. timeUnitSeconds: 5183999,
  476. localeTimeUnit: 'week'
  477. },
  478. {
  479. timeUnitSeconds: 5184000,
  480. localeTimeUnit: 'month'
  481. },
  482. {
  483. timeUnitSeconds: 62207999,
  484. localeTimeUnit: 'month'
  485. },
  486. {
  487. timeUnitSeconds: 622080000,
  488. localeTimeUnit: 'year'
  489. },
  490. {
  491. timeUnitSeconds: 700000000,
  492. localeTimeUnit: 'year'
  493. }
  494. ];
  495. beforeEach(function () {
  496. sinon.stub(Rickshaw.Fixtures, 'Time').returns({
  497. unit: function (name) {
  498. return {
  499. name: name
  500. };
  501. }
  502. });
  503. });
  504. afterEach(function () {
  505. Rickshaw.Fixtures.Time.restore();
  506. });
  507. cases.forEach(function (item) {
  508. it(item.timeUnitSeconds + 's', function () {
  509. expect(chartLinearTimeView.localeTimeUnit(item.timeUnitSeconds).name).to.equal(item.localeTimeUnit);
  510. });
  511. });
  512. });
  513. });
  514. describe('App.ChartLinearTimeView.LoadAggregator', function () {
  515. var aggregator = App.ChartLinearTimeView.LoadAggregator;
  516. describe("#groupRequests()", function () {
  517. var result;
  518. beforeEach(function () {
  519. var requests = [
  520. {
  521. name: 'r1',
  522. context: 'c1',
  523. fields: ['f1']
  524. },
  525. {
  526. name: 'r2',
  527. context: 'c2',
  528. fields: ['f2']
  529. },
  530. {
  531. name: 'r2',
  532. context: 'c3',
  533. fields: ['f3', 'f4']
  534. }
  535. ];
  536. result = aggregator.groupRequests(requests);
  537. });
  538. it("result['r1'].subRequests.length", function () {
  539. expect(result.r1.subRequests.length).to.equal(1);
  540. });
  541. it("result['r1'].fields.length", function () {
  542. expect(result.r1.fields.length).to.equal(1);
  543. });
  544. it("result['r2'].subRequests.length", function () {
  545. expect(result.r2.subRequests.length).to.equal(2);
  546. });
  547. it("result['r2'].fields.length", function () {
  548. expect(result.r2.fields.length).to.equal(3);
  549. });
  550. });
  551. describe("#runRequests()", function () {
  552. beforeEach(function () {
  553. sinon.stub(aggregator, 'groupRequests', function (requests) {
  554. return requests;
  555. });
  556. sinon.stub(aggregator, 'formatRequestData', function(_request){
  557. return _request.fields;
  558. });
  559. App.ajax.send.restore();
  560. sinon.stub(App.ajax, 'send', function(){
  561. return {
  562. done: Em.K,
  563. fail: Em.K,
  564. always: Em.K
  565. }
  566. });
  567. });
  568. afterEach(function () {
  569. aggregator.groupRequests.restore();
  570. aggregator.formatRequestData.restore();
  571. });
  572. it("valid request is sent", function () {
  573. var context = Em.Object.create({
  574. content: {
  575. hostName: 'host1'
  576. },
  577. runningRequests: []
  578. });
  579. var requests = {
  580. 'r1': {
  581. name: 'r1',
  582. context: context,
  583. fields: ['f3', 'f4']
  584. }
  585. };
  586. aggregator.runRequests(requests);
  587. var args = testHelpers.findAjaxRequest('name', 'r1');
  588. expect(args[0]).exists;
  589. expect(args[0].sender).to.be.eql(context);
  590. expect(args[0].data).to.be.eql({
  591. fields: ['f3', 'f4'],
  592. hostName: 'host1'
  593. });
  594. });
  595. });
  596. describe("#formatRequestData()", function () {
  597. var cases = [
  598. {
  599. currentTimeIndex: 0,
  600. customStartTime: 100000,
  601. customEndTime: 200000,
  602. result: 'f3[400,4000,15],f4[400,4000,15]',
  603. title: 'preset time range'
  604. },
  605. {
  606. currentTimeIndex: 8,
  607. customStartTime: 100000,
  608. customEndTime: 200000,
  609. result: 'f3[100,200,15],f4[100,200,15]',
  610. title: 'custom time range'
  611. },
  612. {
  613. currentTimeIndex: 8,
  614. customStartTime: null,
  615. customEndTime: null,
  616. result: 'f3[400,4000,15],f4[400,4000,15]',
  617. title: 'custom time range, no boundaries set'
  618. }
  619. ];
  620. beforeEach(function () {
  621. sinon.stub(App, 'dateTime').returns(4000000);
  622. });
  623. afterEach(function () {
  624. App.dateTime.restore();
  625. });
  626. cases.forEach(function (item) {
  627. it(item.title, function () {
  628. var context = Em.Object.create({
  629. timeUnitSeconds: 3600,
  630. currentTimeIndex: item.currentTimeIndex,
  631. customStartTime: item.customStartTime,
  632. customEndTime: item.customEndTime
  633. });
  634. var request = {
  635. name: 'r1',
  636. context: context,
  637. fields: ['f3', 'f4']
  638. };
  639. expect(aggregator.formatRequestData(request)).to.equal(item.result);
  640. });
  641. });
  642. });
  643. });