Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

query-options.test.ts

24 lines770 Bytes

1import { describe, expect, it } from 'vitest'
2import { queryOptions } from '../query-options'
3import type { CreateQueryOptions } from '../types'
4​
5describe('queryOptions', () => {
6 it('should return the object received as a parameter without any modification.', () => {
7 const object: CreateQueryOptions = {
8 queryKey: ['key'],
9 queryFn: () => Promise.resolve(5),
10 } as const
11​
12 expect(queryOptions(object)).toBe(object)
13 })
14​
15 it('keeps notifyOnChangeProps adapter-owned', () => {
16 const options: CreateQueryOptions = {
17 queryKey: ['key'],
18 // @ts-expect-error Angular Query always subscribes to every result change.
19 notifyOnChangeProps: ['data'],
20 }
21​
22 expect(options).toHaveProperty('notifyOnChangeProps', ['data'])
23 })
24})