SinonJS: calledWith() with exact object

Discussão em 'Angular' iniciado por serlingpa, Fevereiro 7, 2025.

  1. serlingpa

    serlingpa Guest

    I am trying to test that a spy in my Sinon tests is being called with an exact object: no missing properties, no additional properties and no changed properties.

    I have this:

    assert( viewer.entities.add.calledWith( completeEntityObject ) );


    but if I omit some properties from completeEntityObject, the test succeeds. I would like it to fail. I would like a deep comparison.

    I have tried looking at the sinon.match methods but, although there are tests for arrays being deeply equal, there is no such test for objects. How can I accomplish this?

    Continue reading...

Compartilhe esta Página