Issue #32: Add test to materialized view that is not origin

Signed-off-by: Lucas Fernandes de Oliveira's avatarLucas Fernandes de Oliveira <lfo14@inf.ufpr.br>
parent b027d4a1
Pipeline #11314 passed with stage
in 42 seconds
......@@ -93,6 +93,16 @@ schema:
- "dim:6"
metrics:
- "met:9"
-
alias: "view 9"
data: "test/postgres/fixtures/view9.json"
origin: false
dimensions:
- "dim:2"
metrics:
- "met:5"
- "met:6"
- "met:7"
metrics:
-
name: "met:0"
......
......@@ -298,4 +298,23 @@ describe("postgres adapter", () => {
done();
});
});
it("should get data using COUNT when the view is not origin", (done) => {
let view = adapterScenario.notOriginCount;
adapter.getDataFromView(view, (err, result) => {
expect(err).to.be.a("null");
expect(result).to.be.an("array");
expect(result).to.have.length(5);
expect(result[0]).to.be.an("object");
let keys: string[] = [];
keys = keys.concat(view.metrics.map((item) => item.name));
keys = keys.concat(view.dimensions.map((item) => item.name));
result.forEach((row) => {
expect(row).to.be.an("object");
expect(row).to.have.all.keys(keys);
});
done();
});
});
});
[
{"dim:2":"1","met:5":"1","met:6":"1","met:7":"1"},
{"dim:2":"2","met:5":"2","met:6":"1","met:7":"1"},
{"dim:2":"3","met:5":"3","met:6":"1","met:7":"1"},
{"dim:2":"4","met:5":"4","met:6":"1","met:7":"1"},
{"dim:2":"5","met:5":"5","met:6":"1","met:7":"1"}
]
......@@ -51,6 +51,7 @@ interface AdapterScenario {
gtltView: View;
geleView: View;
notMatchFilterView: View;
notOriginCount: View;
}
interface DataCtrlScenario {
......@@ -299,6 +300,13 @@ const withSelView = new View({
childViews: [views[0], views[4]]
});
const notOriginCount = new View({
metrics: [mets[5], mets[6], mets[7]],
dimensions: [dims[2]],
materialized: true,
origin: false
});
export const engineScenario: EngineScenario = {
metrics: mets,
dimensions: dims,
......@@ -322,7 +330,8 @@ export const adapterScenario: AdapterScenario = {
notEqualView: notEqualView,
gtltView: gtltView,
geleView: geleView,
notMatchFilterView: notMatchFilterView
notMatchFilterView: notMatchFilterView,
notOriginCount: notOriginCount
};
export const dataCtrlScenario: DataCtrlScenario = {
......
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