Open History to see the last commit
1import { mutationOptions } from '../mutation-options'
2β
3describe('mutationOptions', () => {
4 test('should not allow excess properties', () => {
5 return mutationOptions({
6 mutationFn: () => Promise.resolve(5),
7 mutationKey: ['key'],
8 // @ts-expect-error this is a good error, because onMutates does not exist!
9 onMutates: 1000,
10 })
11 })
12β
13 test('should infer types for callbacks', () => {
14 return mutationOptions({
15 mutationFn: () => Promise.resolve(5),
16 mutationKey: ['key'],
17 onSuccess: (data) => {
18 expectTypeOf(data).toEqualTypeOf<number>()
19 },
20 })
21 })
22})