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

test-utils.ts

19 lines666 Bytes

1import { provideZonelessChangeDetection } from '@angular/core'
2import { TestBed } from '@angular/core/testing'
3import { provideTanStackQuery } from '@tanstack/angular-query'
4import type { QueryClient } from '@tanstack/query-core'
5import type { EnvironmentProviders, Provider } from '@angular/core'
6​
7export function setupTanStackQueryTestBed(
8 queryClient: QueryClient,
9 options: { providers?: Array<Provider | EnvironmentProviders> } = {},
10) {
11 TestBed.resetTestingModule()
12 TestBed.configureTestingModule({
13 providers: [
14 provideZonelessChangeDetection(),
15 provideTanStackQuery(() => queryClient),
16 ...(options.providers ?? []),
17 ],
18 })