Skip to main content

I am developing a new zap integration.
During the tests executed via “zapier test” is it possible to manipulate a MongoDB database to create new entities (user, oAuthClient, items, ...) allowing me to test authentication, triggers and actions on real datas.

 

Thanks in advance

Hi @akta3d!

I don’t think that’s possible but let me see if we can get a more definitive answer for you :) @Zane are you able to confirm whether what @akta3d is asking is possible?


If I understand the question right, short answer is yes.. you can configure the code that your CLI test suite runs to do pretty much anything you can do from your local environment.

I’m assuming you want to build in a setup script that seeds your API/back end with test data, that your subsequent tests of your triggers and actions have guaranteed results you can build assertions around. 

If you use the scaffolding took in the CLI, we currently configure your project to use Jest. And you’ll find lots of good examples on the web of configuring test suites with setup and teardown configurations. You can also swap out to another node testing library if you prefer.

A different way to go, is to use a mock library, so that you’re not dependent on the configuration of the back end and can focus on fast testing of just your Zapier integration logic.  Something like nock, one that some folks here like to use.

Both approaches have their strengths. And both should be augmented by testing by making real Zaps in the the Zapier product, and running each trigger and action before putting any integration version into production. 


Thanks @Zane 

You understand my question. Sorry for my poor english?

Yes the goal is to avoid mockking request, I prefer use a testing database, add seeds before running tests and run test on a real environment.

 

Thanks