I am using a jest it.each block to reduce the repetitiveness of the test case for same scenario, but i could not able to dynamically update the it block description. how to do that?
example test case
const testData = [
{
module: 'test_module',
entityName: 'test_entity'
},
{
module: 'test_module1',
entityName: 'test_entity1'
},
];
it.each(testData)(`should perform get respose - ${entityName}`, async (entityDetails: any) => {
const url = `${entityDetails.module}/${entityDetails.entityName}/all/`;
// Executing
const response = await request(server).get(url);
// Verifying
expect(response.status).toBe(200);
});
In this provided example, i need entity name to be in it block description dynamically. something like
should perform get respose - test_entity
should perform get respose - test_entity1
how to achieve this?