12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- /**
- *
- *
- * @author Mai
- * @date
- * @version
- */
- const { app, assert } = require('egg-mock/bootstrap');
- const mockData = {};
- const tenderId = 3992;
- const stageOrder = 1;
- const postData = {
- account: 'fuqingqing',
- project: 'P0505',
- project_password: '123456',
- };
- describe('temp_test.js', () => {
- // 准备测试数据
- before(function* () {
- const ctx = app.mockContext();
- // 模拟登录session
- ctx.session = {};
- const loginResult = yield ctx.service.projectAccount.accountLogin(postData, 2);
- assert(loginResult);
- mockData.session = ctx.session;
- });
- it('test temp', function* () {
- const ctx = app.mockContext(mockData);
- // 大数据材差 第一期
- const stage = yield ctx.service.stage.getDataByCondition({ tid: tenderId, order: stageOrder });
- console.time('oldQuery');
- const oldResult = yield ctx.service.stageBills.getLastestStageData(tenderId, stage.id);
- console.timeEnd('oldQuery');
- console.time('newQuery');
- const newResult = yield ctx.service.stageBills.getLastestStageData2(tenderId, stage.id);
- console.timeEnd('newQuery');
- assert(oldResult.length === newResult.length);
- });
- });
|