Skip to content

Commit 627ea0b

Browse files
committed
fix type tests for TS 5.5-7
1 parent 62cd730 commit 627ea0b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

packages/toolkit/src/tests/createReducer.test.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -345,24 +345,24 @@ describe('createReducer', () => {
345345
expect(reducer(5, decrement(5))).toBe(0)
346346
})
347347
test('will throw if the same type is used twice', () => {
348-
expect(() =>
349-
createReducer(0, (builder) =>
348+
expect(() => {
349+
createReducer(0, (builder) => {
350350
builder
351351
.addCase(increment, (state, action) => state + action.payload)
352352
.addCase(increment, (state, action) => state + action.payload)
353-
.addCase(decrement, (state, action) => state - action.payload),
354-
),
355-
).toThrowErrorMatchingInlineSnapshot(
353+
.addCase(decrement, (state, action) => state - action.payload)
354+
})
355+
}).toThrowErrorMatchingInlineSnapshot(
356356
`[Error: \`builder.addCase\` cannot be called with two reducers for the same action type 'increment']`,
357357
)
358-
expect(() =>
359-
createReducer(0, (builder) =>
358+
expect(() => {
359+
createReducer(0, (builder) => {
360360
builder
361361
.addCase(increment, (state, action) => state + action.payload)
362362
.addCase('increment', (state) => state + 1)
363-
.addCase(decrement, (state, action) => state - action.payload),
364-
),
365-
).toThrowErrorMatchingInlineSnapshot(
363+
.addCase(decrement, (state, action) => state - action.payload)
364+
})
365+
}).toThrowErrorMatchingInlineSnapshot(
366366
`[Error: \`builder.addCase\` cannot be called with two reducers for the same action type 'increment']`,
367367
)
368368
})
@@ -373,14 +373,14 @@ describe('createReducer', () => {
373373
payload,
374374
})
375375
customActionCreator.type = ''
376-
expect(() =>
377-
createReducer(0, (builder) =>
376+
expect(() => {
377+
createReducer(0, (builder) => {
378378
builder.addCase(
379379
customActionCreator,
380380
(state, action) => state + action.payload,
381-
),
382-
),
383-
).toThrowErrorMatchingInlineSnapshot(
381+
)
382+
})
383+
}).toThrowErrorMatchingInlineSnapshot(
384384
`[Error: \`builder.addCase\` cannot be called with an empty action type]`,
385385
)
386386
})

0 commit comments

Comments
 (0)