0

Currently I'm doing a couple of POC's related with Office Addin testing and can't find documentation about how to test it.

The library documentation has only a couple of example with trivial functionalities but it's a little bit more complex and I can't reach yet.

The test case should be:

A function addWs that add a worksheet in a workbook. Currently I got it.

A Mock with an specific number of worksheets. (Here is that a I want) This is the current Mock that I have:

const ExcelMockData = { context: { workbook: { load: (propertyNames?: string | string[]) => {}, range: { address: 'G4', format: { fill: {}, }, }, protection: { protected: true, }, worksheets: { items: [{}, {}], }, getSelectedRange: function () { return this.range; }, }, },

run: async function (callback: any) { await callback(this.context); }, };

A test that proves that the number of worksheets increase after call my function addWs

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
cgodev
  • 21
  • 2
  • You asked this under a different account yesterday. Your question is missing too many details to be meaningful. – findwindow Jul 27 '22 at 14:48
  • Yep. Is the same account. Yesterday my question was closed but I don't know why. What is missing? I'm new here and would be helpful if you can bring me more details about wich things needs to be added or how to rephrase my question. thx in advance :) – cgodev Jul 27 '22 at 20:24
  • If I understood correctly, the problem you face is that you want to mock functions created in runtime right? If so, I think you would have to manually mock the functions as they are being created and I don't know another way around that. – Igor Jul 28 '22 at 16:26
  • Is this issue resolved? If no, could you provide more information to let us know the problem? Thanks! – Jinghui-MSFT Aug 01 '22 at 03:12

0 Answers0