xrm-mock icon indicating copy to clipboard operation
xrm-mock copied to clipboard

How to stub Xrm.Navigation.navigateTo() function?

Open roryd opened this issue 3 years ago • 2 comments

I see in /src/xrm-mock/navigation/navigation.mock.ts that not all Xrm.Navigation functions are mocked. There's an error message suggesting to use Sinon.JS to stub certain functions, which I am attempting by attempting a very simple test:

it("should stub Xrm.Navigation.navigateTo", function() {
        const navigateToStub = sinon.stub(Xrm.Navigation, "navigateTo");
    });

This results in the following error:

TypeError: Cannot stub non-existent property navigateTo

It's not a deal-breaker even though the method under test navigates to a different entity after a specific function succeeds. It's just out of curiosity that I am trying to figure out how one might stub a function that is not implemented by xrm-mock just yet.

roryd avatar Sep 25 '20 21:09 roryd

I already done in my repo. Let I do PR.

phuocle avatar Sep 26 '20 01:09 phuocle

Did this ever get done @phuocle ?

daryllabar avatar Nov 03 '21 11:11 daryllabar