Jest test mocks for Excel calculate method

Fewelebele 1 Reputation point
2022-07-12T15:06:12.763+00:00

I am new in creating Jest test scenarios. I was trying to create a mock data and test coverage for a Excel calculate method ( context.application.calculate(Excel.CalculationType.full) ) and I struggle to figure out what the test function should receive and what to expect when whole workbook is being recalculated.

I've been looking on how to do it on : https://learn.microsoft.com/en-us/office/dev/add-ins/testing/unit-testing#install-the-tool but my function is different than any shown here.

The function that needs to be tested is this:

const recalculateWorkbook = async () => {  
  await Excel.run(async (context) => {  
    context.application.calculate(Excel.CalculationType.full);  
    await context.sync();  
  }).catch(function (error) {  
    console.log(error);  
  });  
};  
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,720 questions
{count} votes