cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAP CAPM unit testing issue when using Change Log Activation annotation.

vishnu4
Associate
Associate
0 Kudos
185

Dear Team,

in SAP CAPM application, adapted change log service for field is Active with below annotation and library.

  •  "@cap-js/change-tracking": "^1.0.7",
  • annotateService.Product with {
             isActive @changelog;
         }

While writing a unit test in memory DB, if facing an issue, please help to solve the issue.

console.error
[error] - 500 > {
code: '500',
message: 'no such table: sap_changelog_ChangeLog in:\n' +
'INSERT INTO sap_changelog_ChangeLog (entity,entityKey,serviceEntity,changes) VALUES (?,?,?,?)'
}

Please give suggestion how to handle mock the changelog service or create temp CSV file to avoid error.

 

Sample code :

  it("Create Product OData Service with delegate is not provided", async () => {
    const inputProduct = {
      "externalID": "12345",
      "name": "Project Alpha",
      "productOwner_ID": "101",
      "delegate_ID": null,
      "testCoordinator_ID": "103",
      "testLead_ID": "104"
    };

    const { status, statusText, data } = await POST(
      "/odata/v4/service/Product", inputProduct
    );
    draftId = data.ID;
    expect(status).toBe(201);
    expect(statusText).toBe("Created");
    console.log(draftId)

  });

  it("Activate the draft (SAVE button) ", async () => {
  
      const response = await POST(
        `/odata/v4/service/Product(ID=${draftId},IsActiveEntity=false)/Service.draftActivate`
      );
      expect(response.status).toBe(201);
   
  });
 
Thank & Regards,
Vishnu

 

 

Accepted Solutions (0)

Answers (0)