Browse Source

refactor/Added some unit test for table api

pull/3358/head
Muhammed Mustafa 2 years ago
parent
commit
79831e3f0c
  1. 38
      packages/nocodb/src/__tests__/unit/rest/tests/table.test.ts

38
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 () {

Loading…
Cancel
Save