'use strict';

/**
 * 指标节点业务逻辑 单元测试
 *
 * @author Mai
 * @data 2018/4/20
 * @version
 */

const { app, assert } = require('egg-mock/bootstrap');
// excel解析
const excel = require('node-xlsx');

describe('test/app/service/template_node.test.js', () => {
    it('_parseSheetData test', function () {
        const ctx = app.mockContext();
        const fileName = app.baseDir + '/test/app/service/test.xls';
        const sheets = excel.parse(fileName);
        const nodes = [], indexes = [];
        for (const sheet of sheets) {
            ctx.service.templateNode._parseSheetData(sheet, nodes, indexes);
        }
        assert(nodes.length === 5);
        assert(indexes.length === 42);
    });
});