@@ -9,7 +9,7 @@ const test = require('ava');
9
9
10
10
test (' some test' , async t => {
11
11
try {
12
- await potentiallyThrowingFunction ();
12
+ await throwingFunction ();
13
13
t .fail ();
14
14
} catch (error) {
15
15
t .is (error .message , ' Unicorn overload' );
@@ -23,8 +23,8 @@ test('some test', async t => {
23
23
const test = require (' ava' );
24
24
25
25
test (' 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 ' );
28
28
});
29
29
```
30
30
@@ -33,11 +33,11 @@ const test = require('ava');
33
33
34
34
test (' some test' , async t => {
35
35
try {
36
- const result = await promiseThatMaybeFails ();
36
+ const result = await potentiallyThrowingFunction ();
37
37
// 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 ');
39
39
} catch (error) {
40
- t .is (error, ' good error message ' );
40
+ t .is (error . message , ' Unicorn overload ' );
41
41
}
42
42
});
43
43
```
@@ -47,13 +47,13 @@ const test = require('ava');
47
47
48
48
test (' some test' , async t => {
49
49
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 ();
52
52
await anotherPromise;
53
- await timeout (100 , ' good error message ' );
53
+ await timeout (100 , ' Unicorn timeout ' );
54
54
t .fail ();
55
55
} catch (error) {
56
- t .is (error, ' good error message' );
56
+ t .ok (error . message . startsWith ( ' Unicorn ' ) );
57
57
}
58
58
});
59
59
```
0 commit comments