Skip to content

Instantly share code, notes, and snippets.

@reime005
Created December 27, 2020 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save reime005/7f1dba23adb1cc84a4defba35b7dc120 to your computer and use it in GitHub Desktop.
Save reime005/7f1dba23adb1cc84a4defba35b7dc120 to your computer and use it in GitHub Desktop.
export default async function expectEvent(promise, eventName = "") {
try {
let result = await promise;
let found = false;
if (Array.isArray(result.logs)) {
found = result.logs.find(log => log.event === eventName);
}
if (found) {
return;
}
assert.fail("Expected event, got '" + result.logs + "' instead");
} catch (e) {
console.log(e);
}
assert.fail();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment