Skip to content

Commit

Permalink
Add Event class for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaemming committed Dec 1, 2023
1 parent 60e05e0 commit 5bd9d73
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions plugin-server/tests/helpers/promises.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,22 @@ export function createPromise<T = void>(): MockPromise<T> {

return result as MockPromise<T>
}

export class Event {
private promise: Promise<void>
private resolve: () => void

constructor() {
this.promise = new Promise((resolve) => {
this.resolve = resolve
})
}

public set() {
this.resolve()
}

public async wait() {
return this.promise
}
}

0 comments on commit 5bd9d73

Please sign in to comment.