$kind: http-request
description: Get list of all economic activities
url: "{{csmisUrl}}/marketing/farmer-collected-weight"
method: POST
headers:
  cooperativeApiToken: dQdH8hlyOAfi5PVKVBWNzPOsIqqc9AKcouKSdJDyAcs=
scripts:
  - type: afterResponse
    code: >-
      pm.test("Response status code is 400", function () {
          pm.expect(pm.response.code).to.equal(400);
      });



      pm.test("Verify the content type is application/json", function () {
          pm.expect(pm.response.headers.get("Content-Type")).to.include("application/json");
      });



      pm.test("Response body contains expected fields", function () {
          const responseData = pm.response.json();
          
          pm.expect(responseData).to.have.property('statusCode');
          pm.expect(responseData).to.have.property('data');
          pm.expect(responseData).to.have.property('message');
      });



      pm.test("Errors object is present and not empty", function () {
        const responseData = pm.response.json();
        
        pm.expect(responseData).to.have.property('data');
        pm.expect(responseData.data).to.have.property('errors').and.to.not.be.empty;
      });



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