Browse Source

test(nocodb): add testDescSortedGroupedViewDataList

pull/3563/head
Wing-Kam Wong 2 years ago
parent
commit
02ee23d1b7
  1. 34
      packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

34
packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

@ -294,6 +294,40 @@ function viewRowTests() {
await testDescSortedViewDataList(customerGridView);
});
const testDescSortedGroupedViewDataList = async (view: View) => {
const ratingColumn = filmColumns.find((c) => c.title === 'Rating');
const titleColumn = filmColumns.find((col) => col.title === 'Title');
const visibleColumns = [titleColumn];
const sortInfo = [{ fk_column_id: titleColumn.id, direction: 'desc' }];
const response = await request(context.app)
.get(
`/api/v1/db/data/noco/${sakilaProject.id}/${filmTable.id}/views/${view.id}/group/${ratingColumn.id}`
)
.set('xc-auth', context.token)
.query({
fields: visibleColumns.map((c) => c.title),
sortArrJson: JSON.stringify(sortInfo),
})
.expect(200);
expect(response.body).to.be.an('array');
// PG, R, NC-17, G, PG-17, null (uncategorized)
expect(response.body).to.be.have.length(6);
expect(
response.body.find((e) => e.key === 'PG').value.list[0].Title
).to.equal('WORST BANGER');
};
it('Get desc sorted table data list with required columns kanban', async function () {
await testDescSortedGroupedViewDataList(filmKanbanView);
});
const testAscSortedViewDataList = async (view: View) => {
const firstNameColumn = customerColumns.find(
(col) => col.title === 'FirstName'

Loading…
Cancel
Save