Browse Source

test: ut fix for delete handling

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5874/head
Raju Udava 1 year ago
parent
commit
1d8b3bc752
  1. 14
      packages/nocodb/tests/unit/rest/tests/tableRow.test.ts
  2. 14
      packages/nocodb/tests/unit/rest/tests/viewRow.test.ts

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

@ -1422,20 +1422,14 @@ function tableTest() {
rowId: row['Id'],
});
const response = await request(context.app)
await request(context.app)
.delete(`/api/v1/db/data/noco/${project.id}/${table.id}/${row['Id']}`)
.set('xc-auth', context.token)
.expect(400);
.expect(200);
const deleteRow = await getRow(context, { project, table, id: row['Id'] });
if (!deleteRow) {
throw new Error('Should not delete');
}
if (
!(response.body.msg as string).includes('is a LinkToAnotherRecord of')
) {
throw new Error('Should give LTAR foreign key error');
if (deleteRow !== undefined) {
throw new Error('Record should have been deleted!');
}
});

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

@ -1368,22 +1368,16 @@ function viewRowTests() {
rowId: row['Id'],
});
const response = await request(context.app)
await request(context.app)
.delete(
`/api/v1/db/data/noco/${project.id}/${table.id}/views/${view.id}/${row['Id']}`,
)
.set('xc-auth', context.token)
.expect(400);
.expect(200);
const deleteRow = await getRow(context, { project, table, id: row['Id'] });
if (!deleteRow) {
throw new Error('Should not delete');
}
if (
!(response.body.msg as string).includes('is a LinkToAnotherRecord of')
) {
throw new Error('Should give ltar foreign key error');
if (deleteRow !== undefined) {
throw new Error('Record should have been deleted!');
}
};

Loading…
Cancel
Save