| 12345678910111213141516171819202122232425262728 | 'use strict';/** * * * @author Mai * @date * @version */const { app, assert } = require('egg-mock/bootstrap');const excel = require('node-xlsx');describe('test/app/service/deal_bills.test.js', () => {    it('test import Excel data', function* () {        const ctx = app.mockContext();        const file = app.baseDir  + '/test/app/test_file/deal-upload-test.xls';        const sheets = excel.parse(file), testTenderId = 3;        const result = yield ctx.service.dealBills.importData(sheets[0], testTenderId);        assert(result);        const bills = yield ctx.service.dealBills.getAllDataByCondition({where: {tender_id: testTenderId}});        assert(bills.length === 1);        assert(bills[0].code === '101-1');        assert(bills[0].tender_id === testTenderId);    });});
 |