Using sanjo:jasmine - publishFunctions is not defined on server


#1
expect(Meteor.publishFunctions).toBeDefined(); // fails

This fails for me on server side. I’ve read the source code of meteor-stubs and I thought it was stubbing that for me.
I’m probably doing something wrong but it’s not clear to me what it is.


#2

This is not a standard Meteor method. From which package is this?


#3

Maybe I’m getting things messy.
I mean this: https://github.com/meteor-velocity/meteor-stubs/blob/master/index.js#L211

I’m trying to test a publication, like this:


#4

This should (only) work in server unit mode. If not I can have a look.


#5

Hmmm I haven’t done anything to differentiate unit and integrations tests. I think that’s why.
Here is the project: https://github.com/gabrielhpugliese/statuspage

I’ve just created that unit folder on the only package the project has. I suppose I had to do something more than that.


#6

Forgot to mention that I’m running with command VELOCITY_TEST_PACKAGES=1 meteor test-packages --driver-package velocity:html-reporter


#7

Package testing only uses the Server Integration and Client Integration mode. So the stubs are not used.

I think you can test your publication with a client integration test by using Meteor.subscribe and then check the collection for the expected documents.


#8

Any possibility to patch the Meteor.publish function before the execution of code? :frowning:


#9

No. But I think you can access your publish functions with Meteor.server.publish_handlers (Source: https://github.com/meteor/meteor/blob/master/packages/ddp/livedata_server.js#L1428)