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

Example of testing with third-party integrations #29

Open
stephanboersma opened this issue Jan 6, 2025 · 5 comments
Open

Example of testing with third-party integrations #29

stephanboersma opened this issue Jan 6, 2025 · 5 comments

Comments

@stephanboersma
Copy link

Hi,

Would it be possible for you to add an example of testing a module that integrates with a third-party? I could not find any documentation regarding mocking services when using the medusaIntegrationTestRunner.

It would be very valuable to be able to test workflows that rely on third-party modules.

@shahednasser
Copy link
Member

Hi @stephanboersma thank you for submitting this request! We'll look into it.

Can you provide more information on your use case / what you're expecting? While we don't cover specific use cases, it can factor into the example we work on.

@stephanboersma
Copy link
Author

Hi @shahednasser,

Thanks for the swift reply :-)

In my case, I have developed an integration with Shipmondo using the workflow-sdk. When a new order is placed in Medusa, the order + order items are synchronized to Shipmondo.

It would be nice to add an integration test for this workflow but that also requires the Shipmondo client to be mocked which I am not quite sure on how to achieve at this current moment.

@shahednasser
Copy link
Member

Got it. When you say the "Shipmondo client to be mocked" you mean to not actually send the requests to Shipmondo, correct?

I'll look into the best approach for similar scenarios, but is it not possible to use Shipmondo as sandbox for testing? You can maybe enable sandbox based on an option's value. Let me know if this makes sense.

@stephanboersma
Copy link
Author

@shahednasser , Yes that is correct.

I just checked again and discovered a whole new docs site for their api which was not available when developing the integration. They actually provide a sandbox environment now - this can definitely be used :) Thanks for making me check again.

However, I still think it is a highly relevant functionality to allow mocking of third-party services when testing Medusa Modules.

@shahednasser
Copy link
Member

However, I still think it is a highly relevant functionality to allow mocking of third-party services when testing Medusa Modules.

Of course! I'll still look into documenting it for other cases, but I'm glad I could at least resolve your issue for the time being.

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

2 participants