Skip to content

Commit

Permalink
add overlap test
Browse files Browse the repository at this point in the history
  • Loading branch information
EskiMojo14 committed May 4, 2024
1 parent 108f6b3 commit 42363fa
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/toolkit/src/tests/createSlice.test.ts
Expand Up @@ -1120,6 +1120,26 @@ describe('createSlice', () => {
'loader/addLoader/started',
)
})
test('error is thrown if there is name overlap between creators', () => {
const createAppSlice = buildCreateSlice({
creators: {
loader: loaderCreator,
},
})
expect(() =>
createAppSlice({
name: 'loader',
initialState: {} as Partial<Record<string, true>>,
// @ts-expect-error name overlap
creators: { loader: loaderCreator },
reducers: (create) => ({
addLoader: create.loader({}),
}),
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: A creator with the name loader has already been provided to buildCreateSlice]`,
)
})
})
})

Expand Down

0 comments on commit 42363fa

Please sign in to comment.