mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
fix error handling in test saga
Jest used to define fail() but doesn't seem to do this anymore. Replace it with throwing an error instead, which is basically the same thing.
This commit is contained in:
+6
-2
@@ -22,7 +22,9 @@ export class AsyncSaga {
|
||||
channel: this.channel,
|
||||
dispatch: this.dispatch.bind(this),
|
||||
getState: () => this.state,
|
||||
onError: (e) => fail(e),
|
||||
onError: (e, _i): void => {
|
||||
throw e;
|
||||
},
|
||||
},
|
||||
saga,
|
||||
);
|
||||
@@ -68,7 +70,9 @@ export class AsyncSaga {
|
||||
this.task.cancel();
|
||||
await this.task.toPromise();
|
||||
if (this.dispatches.some((x) => x.type !== END.type)) {
|
||||
fail(`unhandled dispatches remain: ${JSON.stringify(this.dispatches)}`);
|
||||
throw Error(
|
||||
`unhandled dispatches remain: ${JSON.stringify(this.dispatches)}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user