temp_test.test.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const { app, assert } = require('egg-mock/bootstrap');
  10. const mockData = {};
  11. const tenderId = 3992;
  12. const stageOrder = 1;
  13. const postData = {
  14. account: 'fuqingqing',
  15. project: 'P0505',
  16. project_password: '123456',
  17. };
  18. describe('temp_test.js', () => {
  19. // 准备测试数据
  20. before(function* () {
  21. const ctx = app.mockContext();
  22. // 模拟登录session
  23. ctx.session = {};
  24. const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
  25. assert(loginResult);
  26. mockData.session = ctx.session;
  27. });
  28. it('test temp', function* () {
  29. const ctx = app.mockContext(mockData);
  30. // 大数据材差 第一期
  31. const stage = yield ctx.service.stage.getDataByCondition({ tid: tenderId, order: stageOrder });
  32. console.time('oldQuery');
  33. const oldResult = yield ctx.service.stageBills.getLastestStageData(tenderId, stage.id);
  34. console.timeEnd('oldQuery');
  35. console.time('newQuery');
  36. const newResult = yield ctx.service.stageBills.getLastestStageData2(tenderId, stage.id);
  37. console.timeEnd('newQuery');
  38. assert(oldResult.length === newResult.length);
  39. });
  40. });