hemerajs / hemera-testsuite

Helper library to write tests for Hemera.
MIT License
2 stars 4 forks source link

How to stub functions inside actions? #7

Closed vforv closed 6 years ago

vforv commented 7 years ago

Hi,

I added bcrypt module in existing repo:

https://github.com/vforv/hemera-error

And error will occure again inside the second action... Problem is because the second action receive hash from bcrypt function...

So how can I stub bcrypt module and if is it possible to read values of properties from actions? Also is possible to action receive input dynamically from bcrypt?

StarpTech commented 7 years ago

Hi @vforv what's the issue about? Please describe the error in detail.

What do you expect? What is the log? Hemera Version, Node Version, Do you use transpiler?

vforv commented 7 years ago

Hi @StarpTech ,

The code should run until the end but I get the timeout error. The last stubbed action never run because hash that I get from bcrypt function.

For all other details, you can find in repo: https://github.com/vforv/hemera-error

It would also be great if I can inspect the hash variable, and do something like this in the test:

let hash = Here get hash property which is inside addRun call
expect(hash).to.be.exist();
StarpTech commented 7 years ago

@vforv please clean up your code and reduce it to the bare of minimum. Attach always a log trace.

The last stubbed action never run because hash that I get from bcrypt function.

That makes no sense to me

vforv commented 7 years ago

Please check repo again, I added test console log in README and updated code.

Just replace hash values with the same string and it will work, for action and for the stub...

StarpTech commented 6 years ago

Look at https://github.com/hemerajs/hemera-testsuite/pull/9