Skip to content

Commit c59878f

Browse files
committed
add tests
1 parent 42fec38 commit c59878f

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,31 @@ describe('SQL Generation', () => {
361361
type: 'string',
362362
sql: 'source'
363363
},
364+
// dimensions for testing letter cases
365+
my_favorite_source: {
366+
type: 'string',
367+
sql: 'source'
368+
},
369+
My_favorite_source: {
370+
type: 'string',
371+
sql: 'source'
372+
},
373+
MY_favorite_source: {
374+
type: 'string',
375+
sql: 'source'
376+
},
377+
My_Favorite_Source: {
378+
type: 'string',
379+
sql: 'source'
380+
},
381+
MY_Favorite_SOURCE: {
382+
type: 'string',
383+
sql: 'source'
384+
},
385+
MY_FAVORITE_SOURCE: {
386+
type: 'string',
387+
sql: 'source'
388+
},
364389
created_at: {
365390
type: 'time',
366391
sql: 'created_at',
@@ -5372,4 +5397,54 @@ cubes:
53725397
]);
53735398
});
53745399
});
5400+
5401+
it('Checking member name letter cases', async () => {
5402+
await compiler.compile();
5403+
5404+
const query = new PostgresQuery({ joinGraph, cubeEvaluator, compiler }, {
5405+
measures: [],
5406+
dimensions: [
5407+
'visitors.my_favorite_source',
5408+
'visitors.My_favorite_source',
5409+
'visitors.MY_favorite_source',
5410+
'visitors.My_Favorite_Source',
5411+
'visitors.MY_Favorite_SOURCE',
5412+
'visitors.MY_FAVORITE_SOURCE',
5413+
],
5414+
order: [{
5415+
id: 'visitors.created_at'
5416+
}],
5417+
timezone: 'America/Los_Angeles'
5418+
});
5419+
5420+
const res = await dbRunner.testQuery(query.buildSqlAndParams());
5421+
console.log(JSON.stringify(res));
5422+
5423+
expect(res).toEqual([
5424+
{
5425+
visitors___m_y__f_a_v_o_r_i_t_e__s_o_u_r_c_e: null,
5426+
visitors___m_y__favorite__s_o_u_r_c_e: null,
5427+
visitors___m_y_favorite_source: null,
5428+
visitors___my__favorite__source: null,
5429+
visitors___my_favorite_source: null,
5430+
visitors__my_favorite_source: null,
5431+
},
5432+
{
5433+
visitors___m_y__f_a_v_o_r_i_t_e__s_o_u_r_c_e: 'google',
5434+
visitors___m_y__favorite__s_o_u_r_c_e: 'google',
5435+
visitors___m_y_favorite_source: 'google',
5436+
visitors___my__favorite__source: 'google',
5437+
visitors___my_favorite_source: 'google',
5438+
visitors__my_favorite_source: 'google',
5439+
},
5440+
{
5441+
visitors___m_y__f_a_v_o_r_i_t_e__s_o_u_r_c_e: 'some',
5442+
visitors___m_y__favorite__s_o_u_r_c_e: 'some',
5443+
visitors___m_y_favorite_source: 'some',
5444+
visitors___my__favorite__source: 'some',
5445+
visitors___my_favorite_source: 'some',
5446+
visitors__my_favorite_source: 'some',
5447+
},
5448+
]);
5449+
});
53755450
});

0 commit comments

Comments
 (0)