File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 1- import { Result } from "./attempt.ts" ;
1+ import type { Result } from "./attempt.ts" ;
22
33export type AsyncResult < T , E > = Promise < Result < T , E > > ;
44
Original file line number Diff line number Diff line change @@ -3,13 +3,11 @@ import { assertEquals } from "@std/assert";
33import { asyncAttempt } from "./async_attempt.ts" ;
44
55test ( "asyncAttempt should return a Success<T> when the async function is successful" , async ( ) => {
6- const result = await asyncAttempt ( async ( ) => 1 ) ;
6+ const result = await asyncAttempt ( ( ) => Promise . resolve ( 1 ) ) ;
77 assertEquals ( result , [ undefined , 1 ] ) ;
88} ) ;
99
1010test ( "asyncAttempt should return a Failure<E> when the async function is failed" , async ( ) => {
11- const result = await asyncAttempt ( async ( ) => {
12- throw "err" ;
13- } ) ;
11+ const result = await asyncAttempt ( ( ) => Promise . reject ( "err" ) ) ;
1412 assertEquals ( result , [ "err" , undefined ] ) ;
1513} ) ;
You can’t perform that action at this time.
0 commit comments