diff --git a/packages/nocodb/src/__tests__/unit/rest/tests/table.test.ts b/packages/nocodb/src/__tests__/unit/rest/tests/table.test.ts index e6970dc6b0..68a1658236 100644 --- a/packages/nocodb/src/__tests__/unit/rest/tests/table.test.ts +++ b/packages/nocodb/src/__tests__/unit/rest/tests/table.test.ts @@ -216,6 +216,44 @@ function tableTest() { done(); }); }); + + it('Delete table', function (done) { + request(app) + .delete(`/api/v1/db/meta/tables/${table.id}`) + .set('xc-auth', token) + .send({}) + .expect(200, async (err) => { + if (err) return done(err); + + const tables = await Model.list({ + project_id: project.id, + base_id: project.bases[0].id, + }); + + if (tables.length !== 0) { + return done('Table is not deleted'); + } + + done(); + }); + }); + + // todo: Check the condtion where the table being deleted is being refered by multiple tables + // todo: Check the if views are also deleted + + it.only('Get table', function (done) { + request(app) + .get(`/api/v1/db/meta/tables/${table.id}`) + .set('xc-auth', token) + .send({}) + .expect(200, async (err, res) => { + if (err) return done(err); + + if (res.body.id !== table.id) done('Wrong table'); + + done(); + }); + }); } export default function () {