Browse Source

test: column type specific tests

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/7455/head
mertmit 11 months ago
parent
commit
71cc5b7bf9
  1. 25
      packages/nocodb/tests/unit/rest/tests/columnTypeSpecific.test.ts

25
packages/nocodb/tests/unit/rest/tests/columnTypeSpecific.test.ts

@ -52,6 +52,16 @@ function columnTypeSpecificTests() {
uidt: UITypes.LastModifiedTime,
system: true,
},
{
title: 'nc_created_by',
uidt: UITypes.CreatedBy,
system: true,
},
{
title: 'nc_updated_by',
uidt: UITypes.LastModifiedBy,
system: true,
},
];
describe('Qr Code Column', () => {
@ -214,7 +224,7 @@ function columnTypeSpecificTests() {
expect(unfilteredRecords[0].UpdatedAt).to.equal(null);
});
it('Modify record: verify last-modified-at & modified-by is updated', async () => {
it('Modify record: verify last-modified-at is updated', async () => {
// get current date time
const currentDateTime = new Date();
const d1 = new Date();
@ -280,13 +290,6 @@ function columnTypeSpecificTests() {
// calculate difference between current date time and stored date time
difference = storedDateTime2.getTime() - storedDateTime1.getTime();
expect(difference).to.be.greaterThan(1500);
// verify modified by
expect(updatedRecord[0].UpdatedBy).to.not.equal(null);
expect(updatedRecord[0].UpdatedBy[0].email).to.equal(
'test@example.com',
);
expect(updatedRecord[0].UpdatedBy[0].display_name).to.equal(null);
});
it('Modify record: verify that system fields are RO', async () => {
@ -313,8 +316,8 @@ function columnTypeSpecificTests() {
.send([
{
Id: unfilteredRecords[0].Id,
CreatedBy: 'test@example.com',
UpdatedBy: 'test@example.com',
nc_created_by: 'test@example.com',
nc_updated_by: 'test@example.com',
},
])
.expect(400);
@ -409,7 +412,7 @@ function columnTypeSpecificTests() {
expect(columns.columns[defaultTableColumns.length + 1].system).to.equal(
false,
);
expect(records[0].UpdatedBy).to.deep.equal(null);
expect(records[0].LastModifiedBy).to.deep.equal(null);
// update record should fail
await request(context.app)

Loading…
Cancel
Save