Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
roryd opened this issue Sep 25, 2020 · 2 comments
Open

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

roryd opened this issue Sep 25, 2020 · 2 comments

Comments

@roryd
Copy link

roryd commented Sep 25, 2020

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.

@phuocle
Copy link
Contributor

phuocle commented Sep 26, 2020

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

@daryllabar
Copy link
Collaborator

Did this ever get done @phuocle ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants