report_memory_temp.test.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const { app, assert } = require('egg-mock/bootstrap');
  10. const path = require('path');
  11. let savePath;
  12. const mockData = {};
  13. const reportDataAnalysis = require('../../../app/lib/rpt_data_analysis');
  14. describe('test/app/service/report_memory.test.js', () => {
  15. // 准备测试数据
  16. before(function* () {
  17. const ctx = app.mockContext();
  18. savePath = path.join(ctx.app.baseDir,'report_temp');
  19. // const postData = {
  20. // account: '734406061@qq.com',
  21. // project: 'T201711273363',
  22. // project_password: 'mai654321',
  23. // };
  24. const postData = {
  25. account: 'fuqingqing',
  26. project: 'P0505',
  27. project_password: '123456',
  28. };
  29. ctx.session = {};
  30. const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
  31. assert(loginResult);
  32. mockData.session = ctx.session;
  33. });
  34. // 期部位明细数据
  35. it('test getStagePos', function* () {
  36. const ctx = app.mockContext(mockData);
  37. const select = {
  38. tenders: [{tid: 2283}, {tid: 2281}],
  39. type: 'final',
  40. };
  41. const define = {
  42. enable: true,
  43. setting: JSON.stringify({
  44. title: '请选择汇总的标段',
  45. type: 'final',
  46. })
  47. };
  48. const data = {};
  49. data.mem_gather_stage_pay = yield ctx.service.rptGatherMemory.getGatherStagePay([], define, select);
  50. yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_stage_pay, "", "\t"), path.join(savePath, 'mem_gather_stage_pay.json'));
  51. reportDataAnalysis.analysisObj.gatherSelectConverse.fun(ctx, data, [], {table: ['mem_gather_stage_pay']}, {
  52. tplDefine: {gather_select: define}, cDefine: {gather_select: select}});
  53. yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_stage_pay, "", "\t"), path.join(savePath, 'mem_gather_stage_pay_converse.json'));
  54. });
  55. });