Skip to main content

I have tried adding jest testing to a miro app created with create-miro-app. I get a ‘miro is not defined’ error. Is the only way to run unit tests to mock the miro object? Is it possible to install an sdk or something?

Hey @JohnW122,

Probably Jest isnt aware of the global `miro` object. a quick solution would be to add

global.miro = jest.fn()

to your test file. If your tests use other functions of miro you can also mock them. At this point we dont have a testing SDK available. Lets say you want to test `miro.ui.board.createStickyNode`

global.miro = {

  ui: {

    board: {

      createStickyNode: jest.fn()

    }

  }

}

If you need more specific help, can you share your repo?

Cheers,
Mettin


Reply