From cb8d66d2a40892e55a7e1687a121b7c3ac71528f Mon Sep 17 00:00:00 2001 From: Ankush Kumar Garg Date: Fri, 26 Jun 2026 16:23:44 +0530 Subject: [PATCH] test cases fix --- test/integration/attachments-sdm.test.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/integration/attachments-sdm.test.js b/test/integration/attachments-sdm.test.js index 124aa5aa..bb653671 100644 --- a/test/integration/attachments-sdm.test.js +++ b/test/integration/attachments-sdm.test.js @@ -1822,9 +1822,13 @@ const config = { } expect(response.data.createdBy).toBeTruthy(); expect(response.data.modifiedBy).toBeTruthy(); - // When using named user token, createdBy should match the authenticated username - if (credentials.username) { + // When using named user token, createdBy should match the authenticated username. + // For technicalUser flow, the principal is the client_credentials clientid (not a named user), + // so createdBy must NOT equal the named user. + if (tokenFlow === 'namedUser' && credentials.username) { expect(response.data.createdBy).toBe(credentials.username); + } else if (tokenFlow === 'technicalUser' && credentials.username) { + expect(response.data.createdBy).not.toBe(credentials.username); } // Cleanup @@ -2032,7 +2036,13 @@ describe.only('Attachments Integration Tests --CMIS METADATA', () => { const { getCmisProperty } = require('./utills/cmis-document-helper'); const createdBy = await getCmisProperty(metadataEntityID, "metadata-test.pdf", "cmis:createdBy"); expect(createdBy).toBeTruthy(); - expect(createdBy).toBe(credentials.username); + // For namedUser flow, SDM's cmis:createdBy is the authenticated user. + // For technicalUser flow, it's the client_credentials clientid — must NOT match the named user. + if (tokenFlow === 'namedUser') { + expect(createdBy).toBe(credentials.username); + } else if (tokenFlow === 'technicalUser') { + expect(createdBy).not.toBe(credentials.username); + } console.log(`SDM createdBy field verified: ${createdBy}`); // Cleanup