From 42a602c800b02def68e124d1b37d90e38922d3d6 Mon Sep 17 00:00:00 2001 From: mertmit Date: Sat, 6 Jan 2024 08:47:48 +0000 Subject: [PATCH] test: avoid expecting array for created & lastModified --- .../tests/unit/model/tests/baseModelSql.test.ts | 16 ++++++++++++---- .../unit/rest/tests/columnTypeSpecific.test.ts | 8 ++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts b/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts index f0f8d37530..bc9a7fdfa3 100644 --- a/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts +++ b/packages/nocodb/tests/unit/model/tests/baseModelSql.test.ts @@ -176,10 +176,18 @@ function baseModelSqlTests() { const insertedRows: any[] = await baseModelSql.list(); await baseModelSql.bulkUpdate( - insertedRows.map(({ CreatedAt: _, UpdatedAt: __, ...row }) => ({ - ...row, - Title: `new-${row['Title']}`, - })), + insertedRows.map( + ({ + CreatedAt: _, + UpdatedAt: __, + CreatedBy: ___, + UpdatedBy: ____, + ...row + }) => ({ + ...row, + Title: `new-${row['Title']}`, + }), + ), { cookie: request }, ); diff --git a/packages/nocodb/tests/unit/rest/tests/columnTypeSpecific.test.ts b/packages/nocodb/tests/unit/rest/tests/columnTypeSpecific.test.ts index 3206485f17..79ca1592e2 100644 --- a/packages/nocodb/tests/unit/rest/tests/columnTypeSpecific.test.ts +++ b/packages/nocodb/tests/unit/rest/tests/columnTypeSpecific.test.ts @@ -209,7 +209,7 @@ function columnTypeSpecificTests() { } }); - it('New record: verify system fields', async () => { + it.only('New record: verify system fields', async () => { // created-at is filled with current dateTime, last-modified-at is null // created-by is filled with current user, last-modified-by is null @@ -224,10 +224,10 @@ function columnTypeSpecificTests() { expect(unfilteredRecords[0].UpdatedAt).to.equal(null); expect(unfilteredRecords[0].CreatedBy).to.not.equal(null); - expect(unfilteredRecords[0].CreatedBy[0].email).to.equal( - 'test@example.com', + expect(unfilteredRecords[0].CreatedBy.email).to.equal( + context.user.email, ); - expect(unfilteredRecords[0].CreatedBy[0].display_name).to.equal(null); + expect(unfilteredRecords[0].CreatedBy.display_name).to.equal(null); expect(unfilteredRecords[0].UpdatedBy).to.equal(null); });