Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
500 changes: 440 additions & 60 deletions .github/workflows/MultiTenantintegration_test.yml

Large diffs are not rendered by default.

296 changes: 251 additions & 45 deletions .github/workflows/SingleTenant_integration_test.yml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
gen
gen
/coverage
8 changes: 8 additions & 0 deletions jest-integration-repo-specific.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const integrationconfig = {
verbose: true,
testTimeout: 100000,
testMatch: ["**/test/integration/repo-specific.test.js"],

};

module.exports = integrationconfig;
8 changes: 8 additions & 0 deletions jest-integration-subscription.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const integrationconfig = {
verbose: true,
testTimeout: 100000,
testMatch: ["**/test/integration/subscription.test.js"],

};

module.exports = integrationconfig;
8 changes: 8 additions & 0 deletions jest-integration-versioned.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const integrationconfig = {
verbose: true,
testTimeout: 100000,
testMatch: ["**/test/integration/versioned-repo.test.js"],

};

module.exports = integrationconfig;
32 changes: 30 additions & 2 deletions test/integration/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ class Api {
async checkEntity(appUrl, serviceName, entityName, incidentID){
//Checking to see if the entity exists
try{
response = await axios.get(`
https://${appUrl}/odata/v4/${serviceName}/${entityName}(ID=${incidentID},IsActiveEntity=true)`,
let response = await axios.get(
`https://${appUrl}/odata/v4/${serviceName}/${entityName}(ID=${incidentID},IsActiveEntity=true)`,
this.config
);
incidentID = response.data.ID
Expand Down Expand Up @@ -319,6 +319,34 @@ class Api {
}
}

async fetchMetadataDraft(appUrl, serviceName, entityName, incidentID, attachment) {
let response;

try {
response = await axios.get(
`https://${appUrl}/odata/v4/${serviceName}/${entityName}(ID=${incidentID},IsActiveEntity=false)/references(up__ID=${incidentID},ID=${attachment},IsActiveEntity=false)`,
this.config
);

if (response.status === 200 && response.data) {
return {
status: "OK",
data: response.data
};
} else {
return {
status: "FAILED",
message: "Fetch metadata draft did not return 200 status code. Actual code: " + response.status
};
}
} catch (error) {
return {
status: "FAILED",
message: "Fetch metadata draft API call failed: " + error.message
};
}
}

async updateAttachment(appUrl, serviceName, entityName, incidentID, updateData, attachment){
let response;
try{
Expand Down
47 changes: 47 additions & 0 deletions test/integration/attachments-sdm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,53 @@ const config = {
});
});

describe('Attachments Integration Tests --CMIS METADATA', () => {
it('should verify SDM createdBy field matches the authenticated user', async () => {
// Create a fresh entity with an attachment to verify createdBy
let response = await api.createEntityDraft(appUrl, serviceName, entityName);
if (response.status !== "OK") {
throw new Error("Error : " + response.message);
}
const metadataEntityID = response.incidentID;

const file = {
filename: "metadata-test.pdf",
filepath: "./test/integration/sample.pdf"
};

const postData = {
up__ID: metadataEntityID,
mimeType: "application/pdf",
createdAt: new Date().toISOString(),
createdBy: "test@test.com",
modifiedBy: "test@test.com"
};

response = await api.createAttachment(appUrl, serviceName, entityName, metadataEntityID, postData, file);
if (response.status !== "OK") {
throw new Error("Error : " + response.message);
}

response = await api.saveEntityDraft(appUrl, serviceName, entityName, srvpath, metadataEntityID);
if (response.status !== "OK") {
throw new Error("Error : " + response.message);
}

// Verify cmis:createdBy using CMIS helper
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);
console.log(`SDM createdBy field verified: ${createdBy}`);

// Cleanup
response = await api.deleteEntity(appUrl, serviceName, entityName, metadataEntityID);
if (response.status !== "OK") {
console.warn("Cleanup failed:", response.message);
}
});
});

describe('Attachments Integration Tests --DELETE', () => {
it('should delete the attachments of an entity', async () => {
let response = await api.editEntity(appUrl, serviceName, entityName, incidentID, srvpath);
Expand Down
Loading
Loading