Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function stringifyMemberSql(sql?: () => string) {
}

const sqlStr = sql.toString();
return sqlStr.substring(sqlStr.indexOf('=>') + 3);
return sqlStr.substring(sqlStr.indexOf('=>') + 2).trim();
Copy link
Member

@ovr ovr Jul 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please write a test? We have tests for API gateway.

}

type MemberPath = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,37 @@ describe('transformMetaExtended helpers', () => {
expect(handledCube).toHaveProperty('dimensions');
});

test('transformCube - extends field preservation', () => {
const mockCubeDefinitions = {
BaseCube: { extends: () => 'BaseCube' },
ExtendedCube: { extends: () => 'ExtendedCube' },
AnotherCube: { extends: () => 'AnotherCube' },
TestCube: { extends: () => 'TestCube' },
SampleCube: { extends: () => 'SampleCube' }
};

const mockCubes = [
{ name: 'BaseCube' },
{ name: 'ExtendedCube' },
{ name: 'AnotherCube' },
{ name: 'TestCube' },
{ name: 'SampleCube' }
];

mockCubes.forEach(cube => {
const transformedCube = transformCube(cube, mockCubeDefinitions);
expect(transformedCube).toBeDefined();
expect(transformedCube.extends).toBe(`'${cube.name}'`);
});

// Specific test cases to verify first letter preservation
const baseCube = transformCube({ name: 'BaseCube' }, mockCubeDefinitions);
expect(baseCube.extends).toBe('\'BaseCube\'');

const extendedCube = transformCube({ name: 'ExtendedCube' }, mockCubeDefinitions);
expect(extendedCube.extends).toBe('\'ExtendedCube\'');
});

test('transformDimension', () => {
const handledDimension = transformDimension(MOCK_USERS_CUBE.dimensions.id, MOCK_USERS_CUBE);
expect(handledDimension).toBeDefined();
Expand Down
Loading