Search code examples
meteormeteor-velocity

How do I test emailing in a Velocity end-to-end test?


I'm working on writing end-to-end (client) tests in Velocity, and am trying to figure out how to make sure that emails are being sent. I'm currently using Mocha, but I'm willing to switch to another testing framework if it makes this task easier.


Solution

  • You can use a fixture and override the Email send function like this:

    Email.send = function (options) {
       // store those somewhere like an emailsCollection
       emailsCollection.insert(options);
    }; 
    

    Now you can assert on the emailsCollection in your tests