Skip to content

Commit 922ded3

Browse files
committed
test: update test
1 parent d086fbd commit 922ded3

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

tests/lib/rules/detect-unhandled-async-errors.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ const invalidIfWithThrow = "async function run() {const success = await alert('d
1919
const invalidIfWithThrowTwo = "async function run() {const success = await alert('do something'); if(err) throw new handle('error')}"
2020
const validCatch = "async function run(out) { await out.catch(error => alert('there is an error'))}"
2121
const invalidCatch = "async function run(out) { await out }"
22+
const validCatchError = "async function clientErrorHandler(err, req, res, nextMiddleware) { alert('there is an error') }"
2223

23-
var ruleTester = new RuleTester({
24+
var ruleTester = new RuleTester({
2425
parserOptions: { ecmaVersion: 2018 }
2526
})
2627

@@ -76,4 +77,13 @@ ruleTester.run('detect-unhandled-async-errors', rule, {
7677
}]
7778
}
7879
]
79-
})
80+
})
81+
82+
ruleTester.run('detect-unhandled-async-errors', rule, {
83+
valid: [
84+
{ code: validCatchError }
85+
],
86+
87+
invalid: [
88+
]
89+
})

0 commit comments

Comments
 (0)