**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
});
});
我也想检查标头令牌。我只是导入控制器函数并在测试用例内部和内部调用它,然后再模拟请求但不模拟标头。