report_memory_temp.test.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. describe('test/app/service/report_memory.test.js', () => {
  14. // 准备测试数据
  15. before(function* () {
  16. const ctx = app.mockContext();
  17. savePath = path.join(ctx.app.baseDir,'report_temp');
  18. const postData = {
  19. account: '734406061@qq.com',
  20. project: 'T201711273363',
  21. project_password: 'mai654321',
  22. };
  23. ctx.session = {};
  24. const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
  25. assert(loginResult);
  26. mockData.session = ctx.session;
  27. });
  28. // 期部位明细数据
  29. it('test getStagePos', function* () {
  30. const ctx = app.mockContext(mockData);
  31. // test12 - 第6期
  32. const stage = yield ctx.service.stage.getDataByCondition({tid: 12, order: 6});
  33. const mainData = yield ctx.service.reportMemory.getStagePosCompareData(12, stage.id);
  34. if (mainData instanceof Array) {
  35. yield ctx.helper.saveBufferFile(JSON.stringify(mainData,"","\t"), path.join(savePath, 'mem_stage_pos_compare.json'));
  36. }
  37. });
  38. });