Browse Source

fix/Improved unit tests

pull/3358/head
Muhammed Mustafa 2 years ago
parent
commit
797dac5463
  1. 2
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts
  2. 1
      packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts
  3. 2
      packages/nocodb/tests/unit/rest/tests/tableRow.test.ts

2
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -1976,7 +1976,7 @@ class BaseModelSqlv2 {
public async afterDelete(data: any, _trx: any, req): Promise<void> { public async afterDelete(data: any, _trx: any, req): Promise<void> {
// if (req?.headers?.['xc-gui']) { // if (req?.headers?.['xc-gui']) {
const id = req?.params?.id; const id = req?.params?.id;
Audit.insert({ await Audit.insert({
fk_model_id: this.model.id, fk_model_id: this.model.id,
row_id: id, row_id: id,
op_type: AuditOperationTypes.DATA, op_type: AuditOperationTypes.DATA,

1
packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts

@ -218,6 +218,7 @@ function baseModelSqlTests() {
expect(deletedRow).to.be.undefined; expect(deletedRow).to.be.undefined;
console.log('Delete record', await Audit.projectAuditList(project.id, {}));
const rowDeletedAudit = (await Audit.projectAuditList(project.id, {})).find((audit) => audit.op_sub_type === 'DELETE'); const rowDeletedAudit = (await Audit.projectAuditList(project.id, {})).find((audit) => audit.op_sub_type === 'DELETE');
expect(rowDeletedAudit).to.include({ expect(rowDeletedAudit).to.include({
user: 'test@example.com', user: 'test@example.com',

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

@ -1860,7 +1860,7 @@ function tableTest() {
.expect(400); .expect(400);
if(!response.body.msg.includes("Column 'customer_id' cannot be null")){ if(!response.body.msg.includes("Column 'customer_id' cannot be null")){
console.log(response.body) console.log('Delete list hm with existing ref row id with non nullable clause', response.body)
throw new Error('Wrong error message') throw new Error('Wrong error message')
} }
}) })

Loading…
Cancel
Save