Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/vue-query/src/__tests__/mutationOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@ describe('mutationOptions', () => {
expect(mutationOptions(object)).toStrictEqual(object)
})

it('should return the getter received as a parameter without any modification (with mutationKey in mutationOptions)', () => {
const getter = () =>
({
mutationKey: ['key'],
mutationFn: () => sleep(10).then(() => 5),
}) as const

expect(mutationOptions(getter)).toBe(getter)
})

it('should return the getter received as a parameter without any modification (without mutationKey in mutationOptions)', () => {
const getter = () =>
({
mutationFn: () => sleep(10).then(() => 5),
}) as const

expect(mutationOptions(getter)).toBe(getter)
})

it('should return the number of fetching mutations when used with useIsMutating (with mutationKey in mutationOptions)', async () => {
const isMutatingArray: Array<number> = []
const mutationOpts = mutationOptions({
Expand Down
Loading