Commit a4f36ad1 authored by Lucas Fernandes de Oliveira's avatar Lucas Fernandes de Oliveira

Merge branch 'issue/40' into 'master'

Issue #40: Sort metrics, dimensions and views by alphabetical order in tests

See merge request !31
parents edf43239 73463228
Pipeline #11730 passed with stage
in 42 seconds
...@@ -30,21 +30,9 @@ import { engineScenario } from "../../test/scenario"; ...@@ -30,21 +30,9 @@ import { engineScenario } from "../../test/scenario";
describe("engine class", () => { describe("engine class", () => {
const engine = new Engine(); const engine = new Engine();
const met = engineScenario.metrics.sort((a, b) => { const met = engineScenario.metrics;
const aValue = parseInt(a.name.split(":")[1], 10); const dim = engineScenario.dimensions;
const bValue = parseInt(b.name.split(":")[1], 10); const subdim = engineScenario.subDimensions;
return aValue - bValue;
});
const dim = engineScenario.dimensions.sort((a, b) => {
const aValue = parseInt(a.name.split(":")[1], 10);
const bValue = parseInt(b.name.split(":")[1], 10);
return aValue - bValue;
});
const subdim = engineScenario.subDimensions.sort((a, b) => {
const aValue = parseInt(a.name.split(":")[1], 10);
const bValue = parseInt(b.name.split(":")[1], 10);
return aValue - bValue;
});
const views = engineScenario.views; const views = engineScenario.views;
met.forEach((item) => engine.addMetric(item)); met.forEach((item) => engine.addMetric(item));
......
...@@ -63,9 +63,21 @@ interface DataCtrlScenario { ...@@ -63,9 +63,21 @@ interface DataCtrlScenario {
const config = ConfigParser.parse("config/test.yaml"); const config = ConfigParser.parse("config/test.yaml");
const mets = config.metrics; const mets = config.metrics.sort((a, b) => {
const dims = config.dimensions; const aValue = parseInt(a.name.split(":")[1], 10);
const views = config.views; const bValue = parseInt(b.name.split(":")[1], 10);
return aValue - bValue;
});
const dims = config.dimensions.sort((a, b) => {
const aValue = parseInt(a.name.split(":")[1], 10);
const bValue = parseInt(b.name.split(":")[1], 10);
return aValue - bValue;
});
const views = config.buildViews.sort((a, b) => {
const aValue = parseInt(a.alias.split(" ")[1], 10);
const bValue = parseInt(b.alias.split(" ")[1], 10);
return aValue - bValue;
}).map((item) => item.view);
const filters: { [key: string]: Filter } = { const filters: { [key: string]: Filter } = {
"dim:0:0" : new Filter({ "dim:0:0" : new Filter({
...@@ -166,7 +178,11 @@ const subdims = [ ...@@ -166,7 +178,11 @@ const subdims = [
parent: dims[1], parent: dims[1],
relation: RelationType.DAY relation: RelationType.DAY
}) })
]; ].sort((a, b) => {
const aValue = parseInt(a.name.split(":")[1], 10);
const bValue = parseInt(b.name.split(":")[1], 10);
return aValue - bValue;
});
const dateSubDim = [ const dateSubDim = [
new Dimension ({ new Dimension ({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment