-
Notifications
You must be signed in to change notification settings - Fork 12
Resolve UnhandledRejectionWarning in e2e tests
#281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@HoOngEe I tried to check e2e tests to find other However, when I ran ran |
majecty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your PR fixes the UnhandledRejectionWarning error well.
I found that the expect function to check the error message is not working.
I'll create another issue for it.
Problem
Some e2e tests are emitting
UnhandledPromiseRejectionWarning. When we run the tests, we can see the following warning:Cause
This warning message has occurred since Remove all sdk functtions from e2e tests was merged. I suspect a small mistake was made in this work of modifying the test code. Fundamentally, the reason for
UnhandledPromiseRejectionWarningoccurring is related to the process state below.In this test, the process state of the node must be
runningstate. Here the node is the object of classCodeChain. If the process state isstoppingor others,Error: CodeChain(3) process state is invalid:occurs. Some logic was misimplemented, so I assumed the state has astoppingstate.I found the problem part, which is as follows:
In normal case,
sendPayTx()should be executed andcreatePayTx()insendPayTx()sholud be executed too. In this case, however,sendPayTx()does not work because it is wrapped byexpect(). Then, another code outside the try block is executed withoutsendPayTx()andcreatePayTx()running. Interestingly, the test ends with a message that the test is completed. After the test,sendPayTx()andcreatePayTx()is run and the node with thestoppingstate fails in the following process oncreatePayTx():Since the node is not
runningstate, an error occurs withUnhandledPromiseRejectionWarningduring this process.Solution
If the problem is modified as follows, no further errors will occur.
resolved #276