@@ -9,7 +9,7 @@ const test = require('ava');
99
1010test (' some test' , async t => {
1111 try {
12- await potentiallyThrowingFunction ();
12+ await throwingFunction ();
1313 t .fail ();
1414 } catch (error) {
1515 t .is (error .message , ' Unicorn overload' );
@@ -23,8 +23,8 @@ test('some test', async t => {
2323const test = require (' ava' );
2424
2525test (' some test' , async t => {
26- const error = await t .throws (Promise . reject ( ' error ' ));
27- t .is (error, ' error ' );
26+ const error = await t .throws (throwingFunction ( ));
27+ t .is (error . message , ' Unicorn overload ' );
2828});
2929```
3030
@@ -33,11 +33,11 @@ const test = require('ava');
3333
3434test (' some test' , async t => {
3535 try {
36- const result = await promiseThatMaybeFails ();
36+ const result = await potentiallyThrowingFunction ();
3737 // This passes because using a try-catch can be intentional, for example, to test both the result and the error:
38- // t.is(result, 'good result ');
38+ // t.is(result, 'Unicorn success ');
3939 } catch (error) {
40- t .is (error, ' good error message ' );
40+ t .is (error . message , ' Unicorn overload ' );
4141 }
4242});
4343```
@@ -47,13 +47,13 @@ const test = require('ava');
4747
4848test (' some test' , async t => {
4949 try {
50- // This is also because handling multiple rejection promises with try/catch may be easier or may be a deliberate choice.
51- await promiseThatMaybeFails ();
50+ // This is also because handling multiple promises with try/catch may be easier or may be a deliberate choice.
51+ await potentiallyThrowingFunction ();
5252 await anotherPromise;
53- await timeout (100 , ' good error message ' );
53+ await timeout (100 , ' Unicorn timeout ' );
5454 t .fail ();
5555 } catch (error) {
56- t .is (error, ' good error message' );
56+ t .ok (error . message . startsWith ( ' Unicorn ' ) );
5757 }
5858});
5959```
0 commit comments