peerlibrary / meteor-middleware

Middleware support for Meteor publish functions
https://atmospherejs.com/peerlibrary/middleware
BSD 3-Clause "New" or "Revised" License
14 stars 1 forks source link

[Question] How to do a unit test for publish endpoints? #4

Closed diavrank closed 2 years ago

diavrank commented 3 years ago

Hello, I'm stating to unit tests (using meteortesting:mocha) for my endpoints. I use validated method package for my meteor methods and there is a simple way to do unit tests for those methods. On the other hand, I use this meteor package to make my publications and I wonder if there is a way to do unit tests for publish endpoints?

Can I use a method (like _execute in validated method) from publishEndpoint constant to execute the function of my publication?

mitar commented 2 years ago

I use classy-test for unit testing Meteor. So you setup publish endpoint on the server and then you subscribe from the client, testing the results. It allows interleaving client and server blocks so you can write a test this way.