|
@@ -15,7 +15,7 @@ const excel = require('node-xlsx');
|
|
|
describe('test/app/service/template_node.test.js', () => {
|
|
|
it('_parseSheetData test xls File', function () {
|
|
|
const ctx = app.mockContext();
|
|
|
- const fileName = app.baseDir + '/test/app/service/test.xls';
|
|
|
+ const fileName = app.baseDir + '/test/app/service/test_template.xls';
|
|
|
const sheets = excel.parse(fileName);
|
|
|
const nodes = [], indexes = [], params = [];
|
|
|
|
|
@@ -25,11 +25,11 @@ describe('test/app/service/template_node.test.js', () => {
|
|
|
|
|
|
assert(nodes.length === 5);
|
|
|
assert(indexes.length === 42);
|
|
|
- assert(params.length === 59);
|
|
|
+ assert(params.length === 64);
|
|
|
});
|
|
|
it('_parseSheetData test xlsx File', function () {
|
|
|
const ctx = app.mockContext();
|
|
|
- const fileName = app.baseDir + '/test/app/service/test.xlsx';
|
|
|
+ const fileName = app.baseDir + '/test/app/service/test_template.xlsx';
|
|
|
const sheets = excel.parse(fileName);
|
|
|
const nodes = [], indexes = [], params = [];
|
|
|
|
|
@@ -39,12 +39,12 @@ describe('test/app/service/template_node.test.js', () => {
|
|
|
|
|
|
assert(nodes.length === 3);
|
|
|
assert(indexes.length === 12);
|
|
|
- assert(params.length === 21);
|
|
|
+ assert(params.length === 26);
|
|
|
});
|
|
|
|
|
|
it('importData test xls File', function* () {
|
|
|
const ctx = app.mockContext();
|
|
|
- const fileName = app.baseDir + '/test/app/service/test.xls';
|
|
|
+ const fileName = app.baseDir + '/test/app/service/test_template.xls';
|
|
|
const sheets = excel.parse(fileName), templateId = 0;
|
|
|
|
|
|
yield ctx.service.templateNode.importData(sheets, templateId);
|
|
@@ -54,11 +54,11 @@ describe('test/app/service/template_node.test.js', () => {
|
|
|
const indexes = yield ctx.service.templateIndex.getAllDataByCondition({where: {template_id: templateId}});
|
|
|
assert(indexes.length === 42);
|
|
|
const params = yield ctx.service.templateParam.getAllDataByCondition({where: {template_id: templateId}});
|
|
|
- assert(params.length === 57);
|
|
|
+ assert(params.length === 103);
|
|
|
});
|
|
|
it('importData test xlsx File', function* () {
|
|
|
const ctx = app.mockContext();
|
|
|
- const fileName = app.baseDir + '/test/app/service/test.xlsx';
|
|
|
+ const fileName = app.baseDir + '/test/app/service/test_template.xlsx';
|
|
|
const sheets = excel.parse(fileName), templateId = 0;
|
|
|
|
|
|
yield ctx.service.templateNode.importData(sheets, templateId);
|
|
@@ -68,6 +68,6 @@ describe('test/app/service/template_node.test.js', () => {
|
|
|
const indexes = yield ctx.service.templateIndex.getAllDataByCondition({where: {template_id: templateId}});
|
|
|
assert(indexes.length === 12);
|
|
|
const params = yield ctx.service.templateParam.getAllDataByCondition({where: {template_id: templateId}});
|
|
|
- assert(params.length === 31);
|
|
|
+ assert(params.length === 65);
|
|
|
});
|
|
|
});
|