Skip to content

Commit

Permalink
fixup! fixup! WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardSergeev committed Aug 31, 2023
1 parent a03ab6f commit 733d756
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/test/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ export async function didEvent<TResult, TEvent>(
subscribe: (arg: (event: TEvent) => void) => Disposable,
predicate: (event: TEvent) => boolean,
action: () => Thenable<TResult>): Promise<TResult> {
return new Promise<TResult>((resolve, _) => {
return new Promise<TResult>((resolve, reject) => {
const disposable = subscribe(event => {
if(predicate(event)) {
disposable.dispose();
actionResult.then(result => resolve(result))
actionResult.then(
result => resolve(result),
error => reject(error)
);
}
});
const actionResult = action();
Expand Down

0 comments on commit 733d756

Please sign in to comment.