12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 'use strict';
- /**
- *
- *
- * @author Mai
- * @date 2020/4/17
- * @version
- */
- const { app, assert } = require('egg-mock/bootstrap');
- const path = require('path');
- let savePath;
- const mockData = {};
- describe('test/app/service/rpt_gather_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',
- };
- ctx.session = {};
- const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
- assert(loginResult);
- mockData.session = ctx.session;
- });
- // 期部位明细数据
- it('test getGatherStageBills - month', function* () {
- const ctx = app.mockContext(mockData);
- const select = {
- tenders: [{tid: 2256}, {tid: 2257}, {tid: 2258, gs: true}],
- type: 'month',
- month: '2020-01',
- };
- const define = {
- enable: true,
- setting: {
- title: '请选择汇总的标段',
- type: 'month',
- special: [
- {"title": "批复概算", "key": "gs"}
- ]
- }
- };
- const mem_gather_stage_bills = yield ctx.service.rptGatherMemory.getGatherStageBills([], define, select);
- yield ctx.helper.saveBufferFile(JSON.stringify(mem_gather_stage_bills, "", "\t"), path.join(savePath, 'mem_gather_stage_bills.json'));
- const reportDataAnalysis = require('../../../app/lib/rpt_data_analysis');
- // 配合部位明细
- const reportData = {mem_gather_stage_bills: mem_gather_stage_bills};
- reportDataAnalysis.analysisObj.gatherSelectConverse.fun(ctx, reportData, [], {table: ["mem_gather_stage_bills"]}, {
- cDefine: { gather_select: select },
- tplDefine: {gather_select: define },
- });
- yield ctx.helper.saveBufferFile(JSON.stringify(reportData, "", "\t"), path.join(savePath, 'mem_gather_stage_bills_coverse.json'));
- assert(reportData.mem_gather_stage_bills.length === mem_gather_stage_bills.length * 2);
- });
- });
|