@@ -7,6 +7,7 @@ import { dbRunner } from './PostgresDBRunner';
77describe ( 'PreAggregations' , ( ) => {
88 jest . setTimeout ( 200000 ) ;
99
10+ // language=JavaScript
1011 const { compiler, joinGraph, cubeEvaluator } = prepareCompiler ( `
1112 cube(\`visitors\`, {
1213 sql: \`
@@ -444,29 +445,6 @@ describe('PreAggregations', () => {
444445 }
445446 })
446447
447- cube('VisitorView', {
448- sql: \`SELECT 1\`,
449-
450- measures: {
451- checkinsTotal: {
452- sql: \`\${visitors.checkinsTotal}\`,
453- type: 'number',
454- }
455- },
456-
457- dimensions: {
458- source: {
459- sql: \`\${visitors.source}\`,
460- type: 'string',
461- },
462-
463- createdAt: {
464- sql: \`\${visitors.createdAt}\`,
465- type: 'time'
466- }
467- },
468- });
469-
470448 cube('LambdaVisitors', {
471449 extends: visitors,
472450
@@ -2084,20 +2062,20 @@ describe('PreAggregations', () => {
20842062 it ( 'simple view' , ( ) => compiler . compile ( ) . then ( ( ) => {
20852063 const query = new PostgresQuery ( { joinGraph, cubeEvaluator, compiler } , {
20862064 measures : [
2087- 'VisitorView .checkinsTotal'
2065+ 'visitors_view .checkinsTotal'
20882066 ] ,
20892067 dimensions : [
2090- 'VisitorView .source'
2068+ 'visitors_view .source'
20912069 ] ,
20922070 timezone : 'America/Los_Angeles' ,
20932071 preAggregationsSchema : '' ,
20942072 timeDimensions : [ {
2095- dimension : 'VisitorView .createdAt' ,
2073+ dimension : 'visitors_view .createdAt' ,
20962074 granularity : 'day' ,
20972075 dateRange : [ '2016-12-30' , '2017-01-05' ]
20982076 } ] ,
20992077 order : [ {
2100- id : 'VisitorView .createdAt'
2078+ id : 'visitors_view .createdAt'
21012079 } ] ,
21022080 } ) ;
21032081
@@ -2117,19 +2095,19 @@ describe('PreAggregations', () => {
21172095 expect ( res ) . toEqual (
21182096 [
21192097 {
2120- visitor_view__source : 'some' ,
2121- visitor_view__created_at_day : '2017-01-02T00:00:00.000Z' ,
2122- visitor_view__checkins_total : '3'
2098+ visitors_view__source : 'some' ,
2099+ visitors_view__created_at_day : '2017-01-02T00:00:00.000Z' ,
2100+ visitors_view__checkins_total : '3'
21232101 } ,
21242102 {
2125- visitor_view__source : 'some' ,
2126- visitor_view__created_at_day : '2017-01-04T00:00:00.000Z' ,
2127- visitor_view__checkins_total : '2'
2103+ visitors_view__source : 'some' ,
2104+ visitors_view__created_at_day : '2017-01-04T00:00:00.000Z' ,
2105+ visitors_view__checkins_total : '2'
21282106 } ,
21292107 {
2130- visitor_view__source : 'google' ,
2131- visitor_view__created_at_day : '2017-01-05T00:00:00.000Z' ,
2132- visitor_view__checkins_total : '1'
2108+ visitors_view__source : 'google' ,
2109+ visitors_view__created_at_day : '2017-01-05T00:00:00.000Z' ,
2110+ visitors_view__checkins_total : '1'
21332111 }
21342112 ]
21352113 ) ;
@@ -2139,20 +2117,20 @@ describe('PreAggregations', () => {
21392117 it ( 'simple view non matching time-dimension granularity' , ( ) => compiler . compile ( ) . then ( ( ) => {
21402118 const query = new PostgresQuery ( { joinGraph, cubeEvaluator, compiler } , {
21412119 measures : [
2142- 'VisitorView .checkinsTotal'
2120+ 'visitors_view .checkinsTotal'
21432121 ] ,
21442122 dimensions : [
2145- 'VisitorView .source'
2123+ 'visitors_view .source'
21462124 ] ,
21472125 timezone : 'America/Los_Angeles' ,
21482126 preAggregationsSchema : '' ,
21492127 timeDimensions : [ {
2150- dimension : 'VisitorView .createdAt' ,
2128+ dimension : 'visitors_view .createdAt' ,
21512129 granularity : 'month' ,
21522130 dateRange : [ '2016-12-30' , '2017-01-05' ]
21532131 } ] ,
21542132 order : [ {
2155- id : 'VisitorView .createdAt'
2133+ id : 'visitors_view .createdAt'
21562134 } ] ,
21572135 } ) ;
21582136
@@ -2172,14 +2150,14 @@ describe('PreAggregations', () => {
21722150 expect ( res ) . toEqual (
21732151 [
21742152 {
2175- visitor_view__source : 'google' ,
2176- visitor_view__created_at_month : '2017-01-01T00:00:00.000Z' ,
2177- visitor_view__checkins_total : '1'
2153+ visitors_view__source : 'google' ,
2154+ visitors_view__created_at_month : '2017-01-01T00:00:00.000Z' ,
2155+ visitors_view__checkins_total : '1'
21782156 } ,
21792157 {
2180- visitor_view__source : 'some' ,
2181- visitor_view__created_at_month : '2017-01-01T00:00:00.000Z' ,
2182- visitor_view__checkins_total : '5'
2158+ visitors_view__source : 'some' ,
2159+ visitors_view__created_at_month : '2017-01-01T00:00:00.000Z' ,
2160+ visitors_view__checkins_total : '5'
21832161 }
21842162 ]
21852163 ) ;
0 commit comments