Browse Source

refactor/Minor refactor

pull/3358/head
Muhammed Mustafa 2 years ago
parent
commit
7d78a0d3f1
  1. 14
      packages/nocodb/src/__tests__/unit/rest/tests/tableRow.test.ts

14
packages/nocodb/src/__tests__/unit/rest/tests/tableRow.test.ts

@ -662,18 +662,20 @@ function tableTest() {
}); });
it('Sorted Formula column on rollup customer table', async function () { it('Sorted Formula column on rollup customer table', async function () {
const rollupColumnTitle = 'Number of rentals';
const rollupColumn = await createRollupColumn(context, { const rollupColumn = await createRollupColumn(context, {
project, project,
title: 'Number of rentals', title: rollupColumnTitle,
rollupFunction: 'count', rollupFunction: 'count',
table: customerTable, table: customerTable,
relatedTableName: 'rental', relatedTableName: 'rental',
relatedTableColumnTitle: 'RentalDate', relatedTableColumnTitle: 'RentalDate',
}); });
const formulaColumnTitle = 'Formula';
const formulaColumn = await createColumn(context, customerTable, { const formulaColumn = await createColumn(context, customerTable, {
uidt: UITypes.Formula, uidt: UITypes.Formula,
title: 'Formula', title: formulaColumnTitle,
formula: `ADD({${rollupColumn.title}}, 10)`, formula: `ADD({${rollupColumn.title}}, 10)`,
}); });
@ -690,19 +692,19 @@ function tableTest() {
}) })
.expect(200); .expect(200);
if (response.body.list[0][formulaColumn.title] !== 22) if (response.body.list[0][formulaColumnTitle] !== 22)
throw new Error('Wrong sorting'); throw new Error('Wrong sorting');
if ( if (
(response.body.list as Array<any>).every( (response.body.list as Array<any>).every(
(row) => row['Formula'] !== row[rollupColumn.title] + 10 (row) => row['Formula'] !== row[rollupColumnTitle] + 10
) )
) { ) {
throw new Error('Wrong formula'); throw new Error('Wrong formula');
} }
}); });
// it.only('Get nested sorted filtered table with nested fields data list with a formula > lookup > rollup column in customer table', async function () { // it('Get nested sorted filtered table with nested fields data list with a formula > lookup > rollup column in customer table', async function () {
// const rentalTable = await Model.getByIdOrName({ // const rentalTable = await Model.getByIdOrName({
// project_id: project.id, // project_id: project.id,
// base_id: project.bases[0].id, // base_id: project.bases[0].id,
@ -751,5 +753,5 @@ function tableTest() {
} }
export default function () { export default function () {
describe.only('TableRow', tableTest); describe('TableRow', tableTest);
} }

Loading…
Cancel
Save