'use strict';

/**
 *
 *
 * @author Mai
 * @date
 * @version
 */

const { app, assert } = require('egg-mock/bootstrap');

describe('test/app/service/stage_bills.test.js', () => {
    it('test getSumTotalPrice', function* () {
        const ctx = app.mockContext();
        const stage = yield ctx.service.stage.getDataByCondition({
            id: 43
        });
        stage.curTimes = stage.times;
        stage.curOrder = 0;
        const result = yield ctx.service.stageBills.getSumTotalPrice(stage);
        assert(result.contract_tp === 26220);
        assert(result.qc_tp === null);
    });
    it('test getSumTotalPriceGcl', function* () {
        const ctx = app.mockContext();
        const stage = yield ctx.service.stage.getDataByCondition({
            id: 43
        });
        stage.curTimes = stage.times;
        stage.curOrder = 0;
        let result = yield ctx.service.stageBills.getSumTotalPriceGcl(stage, '102-');
        assert(result.contract_tp === 22000);
        assert(result.qc_tp === null);

        result = yield ctx.service.stageBills.getSumTotalPriceGcl(stage, '2[0-9][0-9]-');
        assert(result.contract_tp === 220);
        assert(result.qc_tp === null);
    });
});