123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- 'use strict';
- /**
- *
- *
- * @author Mai
- * @date
- * @version
- */
- const { app, assert } = require('egg-mock/bootstrap');
- const path = require('path');
- let savePath;
- const mockData = {};
- const reportDataAnalysis = require('../../../app/lib/rpt_data_analysis');
- describe('test/app/service/report_memory.test.js', () => {
- // 准备测试数据
- before(function* () {
- const ctx = app.mockContext();
- savePath = path.join(ctx.app.baseDir,'report_temp');
- // const postData = {
- // account: '734406061@qq.com',
- // project: 'T201711273363',
- // project_password: 'mai654321',
- // };
- const postData = {
- account: 'fuqingqing',
- project: 'P0505',
- project_password: '123456',
- };
- ctx.session = {};
- const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
- assert(loginResult);
- mockData.session = ctx.session;
- });
- // 期部位明细数据
- it('test getStagePos', function* () {
- const ctx = app.mockContext(mockData);
- const select = {
- tenders: [{tid: 2283}, {tid: 2281}],
- type: 'final',
- };
- const define = {
- enable: true,
- setting: JSON.stringify({
- title: '请选择汇总的标段',
- type: 'final',
- })
- };
- const data = {};
- data.mem_gather_stage_pay = yield ctx.service.rptGatherMemory.getGatherStagePay([], define, select);
- yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_stage_pay, "", "\t"), path.join(savePath, 'mem_gather_stage_pay.json'));
- reportDataAnalysis.analysisObj.gatherSelectConverse.fun(ctx, data, [], {table: ['mem_gather_stage_pay']}, {
- tplDefine: {gather_select: define}, cDefine: {gather_select: select}});
- yield ctx.helper.saveBufferFile(JSON.stringify(data.mem_gather_stage_pay, "", "\t"), path.join(savePath, 'mem_gather_stage_pay_converse.json'));
- });
- });
|