Skip to content

Lesson 9 unit test timeout error #5051

Answered by gigaBrane
gigaBrane asked this question in Q&A
Discussion options

You must be logged in to vote

I figured it out, resolve() needs to be outside the async function, see below code

await new Promise(async (resolve, reject) => {
            raffle.once("WinnerPicked", async () => {
              console.log("found event")
              try {
                const recentWinner = await raffle.getRecentWinner()
                console.log(recentWinner)
                const raffleState = await raffle.getRaffleState()
                const endingTimeStamp = await raffle.getLatestTimeStamp()
                const numPlayers = await raffle.getNumberOfPlayers()

                assert.equal(numPlayers.toString(), "0")
                assert.equal(raffleState.toString(), "0")
                a…

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@gigaBrane
Comment options

Comment options

You must be logged in to vote
1 reply
@paulcoffee85
Comment options

Comment options

You must be logged in to vote
1 reply
@paulcoffee85
Comment options

Comment options

You must be logged in to vote
4 replies
@paulcoffee85
Comment options

@gigaBrane
Comment options

@paulcoffee85
Comment options

@gigaBrane
Comment options

Answer selected by gigaBrane
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants