aboutsummaryrefslogtreecommitdiff
path: root/test/js/async_finally.t.js
blob: 999c66d7bfa241637475aac95a5a2e395c7f21c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*---
includes: []
flags: [async]
---*/

let called = false;
async function add(x) {
    return await new Promise((resolve, reject) => {reject(x + 1)})
                     .finally(() => {called = true});
}

add(50).catch(e => {
    assert.sameValue(e, 51);
    assert.sameValue(called, true, "finally was not invoked");
}).then($DONE, $DONE);