Skip to content

Commit 5770120

Browse files
committed
Fix code duplication
1 parent 848df18 commit 5770120

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ test('Can pass "icon" as class option', (t) => {
5151
t.true(message.includes(`${figures.warning} ExitCodeError: test`))
5252
})
5353

54+
const inner = new DatabaseError('inner')
55+
const outer = new ExitCodeError('test', { errors: [inner] })
56+
5457
test('Can use aggregate errors', (t) => {
55-
const inner = new DatabaseError('inner')
56-
const outer = new ExitCodeError('test', { errors: [inner] })
5758
const message = BaseError.beautiful(outer)
5859
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
5960
t.is(message, outer.beautiful())
@@ -62,8 +63,6 @@ test('Can use aggregate errors', (t) => {
6263
})
6364

6465
test('Can pass "cause"', (t) => {
65-
const inner = new DatabaseError('inner')
66-
const outer = new ExitCodeError('test', { errors: [inner] })
6766
const message = BaseError.beautiful(outer, { cause: false })
6867
t.true(message.includes(`${figures.warning} ExitCodeError: test`))
6968
t.false(message.includes('DatabaseError'))

0 commit comments

Comments
 (0)