'Authorization header isn't mocked. package: node-mocks-http

**Note:** My test case is running successfully but the issue is it is not mocking the header. 
   

describe('Collection Listing API', () => {
      let req;
      let res;
      let sandbox;
      const token = 'string';
      before(() => {
        req = httpMocks.createRequest({
          method: 'GET',
          url: '/data/collections',
          params: {
            cusId: data.customerId,
          },
          headers: { Authorization: `Bearer ${token}` },
        });
    
        res = httpMocks.createResponse();
        
      });
    
      it.only('should return true for valid collection ', async () => {
       //testcase
      });

    });

i want to check the header token also. I just import the controller function and calling it inside test case and inside before i'm mocking the request but header is not mocked.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source