Jest test mocks for Excel calculate method
Fewelebele
1
Reputation point
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);
});
};
Sign in to answer