test: use emittedCallback instead of wait()

It is environment dependent way that waiting a message is emitted by
wait(). It means that a test may be success or failure.