|
|
@ -2110,6 +2110,54 @@ function tableTest() { |
|
|
|
throw new Error('Wrong error message'); |
|
|
|
throw new Error('Wrong error message'); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it.only('Grouped api', async function () { |
|
|
|
|
|
|
|
const firstNameColumn = customerColumns.find( |
|
|
|
|
|
|
|
(col) => col.title === 'FirstName' |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const filmTable = await getTable({project: sakilaProject, name: 'film'}) |
|
|
|
|
|
|
|
const filmColumns = await filmTable.getColumns(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log(firstNameColumn,filmTable,filmColumns) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// const rollupColumn = await createRollupColumn(context, {
|
|
|
|
|
|
|
|
// project: sakilaProject,
|
|
|
|
|
|
|
|
// title: 'Rollup',
|
|
|
|
|
|
|
|
// rollupFunction: 'count',
|
|
|
|
|
|
|
|
// table: customerTable,
|
|
|
|
|
|
|
|
// relatedTableName: 'rental',
|
|
|
|
|
|
|
|
// relatedTableColumnTitle: 'RentalDate',
|
|
|
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// const visibleColumns = [firstNameColumn];
|
|
|
|
|
|
|
|
// const sortInfo = `-FirstName, +${rollupColumn.title}`;
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// const response = await request(context.app)
|
|
|
|
|
|
|
|
// .get(
|
|
|
|
|
|
|
|
// `/api/v1/db/data/noco/${sakilaProject.id}/${customerTable.id}/group/`
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// .set('xc-auth', context.token)
|
|
|
|
|
|
|
|
// .query({
|
|
|
|
|
|
|
|
// fields: visibleColumns.map((c) => c.title),
|
|
|
|
|
|
|
|
// sort: sortInfo,
|
|
|
|
|
|
|
|
// column_name: firstNameColumn.column_name,
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// .expect(200);
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// if (
|
|
|
|
|
|
|
|
// response.body.list[4]['first_name'] !== 'WILLIE' ||
|
|
|
|
|
|
|
|
// response.body.list[4]['count'] !== 2
|
|
|
|
|
|
|
|
// )
|
|
|
|
|
|
|
|
// throw new Error('Wrong groupby');
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export default function () { |
|
|
|
export default function () { |
|
|
|