$kind: http-request
description: Get list of all economic activities
url: "{{csmisUrl}}/cooperative/amcoss"
method: GET
scripts:
  - type: afterResponse
    code: >-
      pm.test("Response status code is 500", function () {
          pm.expect(pm.response.code).to.equal(500);
      });



      pm.test("Response has the required fields", function () {
          const responseData = pm.response.json();
          
          pm.expect(responseData).to.be.an('object');
          pm.expect(responseData).to.include.all.keys('timestamp', 'status', 'error', 'message', 'path');
      });



      pm.test("Timestamp is in a valid date format", function () {
        const responseData = pm.response.json();
        
        pm.expect(responseData.timestamp).to.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/);
      });



      pm.test("Error message is not empty", function () {
        const responseData = pm.response.json();
        
        pm.expect(responseData.error).to.exist.and.to.not.be.empty;
      });



      pm.test("Path is a non-empty string", function () {
        const responseData = pm.response.json();
        
        pm.expect(responseData.path).to.be.a('string').and.to.have.lengthOf.at.least(1, "Path should not be empty");
      });
    language: text/javascript
order: 4000
