firebase / firebase-functions-test

MIT License
232 stars 48 forks source link

Support for scheduled functions #51

Closed rhodgkins closed 4 years ago

rhodgkins commented 4 years ago

Description

Adds support for scheduled functions that use only the context parameter when called.

Also includes tests.

Code sample

const scheduledFunc = functions.pubsub.schedule('every 2 hours').onRun(async context => {
 // Do something
});

require('firebase-functions-test').wrap(scheduledFunc)();

// Or with a context
require('firebase-functions-test').wrap(scheduledFunc)({ timestamp });
googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

mbleigh commented 4 years ago

@laurenzlong this seems like a reasonable thing to do, but I'm not as familiar with the codebase to know if this is the reasonable way to do it. Can you take a look?

rhodgkins commented 4 years ago

Just to note I'm not really up to scratch with TypeScript so I have no idea if the way I've changed the wrap function signature is the best way to go about things...!

rhodgkins commented 4 years ago

@laurenzlong sorry for the delay. I rebased from master and ran the new prettifier and then implemented the change you requested.

rhodgkins commented 4 years ago

@googlebot I signed it!

googlebot commented 4 years ago

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

googlebot commented 4 years ago

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

rhodgkins commented 4 years ago

@laurenzlong / @mbleigh is it possible to get this reviewed and merged in - thanks!

laurenzlong commented 4 years ago

@rhodgkins thanks for the reminder! Sorry I missed the updates. Thanks again for the contribution! This will be in the 0.2.0 release.

rhodgkins commented 4 years ago

Thanks @laurenzlong - any ideas when v0.2.0 will be released?

laurenzlong commented 4 years ago

We're working on a new release process so it'll be a few days but hopefully not longer than that.

laurenzlong commented 4 years ago

@rhodgkins It's released now!