Skip to content

Commit

Permalink
refactor(angular-query): align inject-query and inject-infinite-query…
Browse files Browse the repository at this point in the history
… + clean-up create-base-query + add query correct type tests (#7593)
  • Loading branch information
Arthie authored Jun 21, 2024
1 parent ea26f26 commit b7aaa03
Show file tree
Hide file tree
Showing 14 changed files with 373 additions and 108 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { TestBed } from '@angular/core/testing'
import { QueryClient } from '@tanstack/query-core'
import { afterEach } from 'vitest'
import { injectInfiniteQuery } from '../inject-infinite-query'
import { provideAngularQuery } from '../providers'
import { QueryClient, injectInfiniteQuery, provideAngularQuery } from '..'
import { expectSignals, infiniteFetcher } from './test-utils'

const QUERY_DURATION = 1000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { TestBed, fakeAsync, flush, tick } from '@angular/core/testing'
import { QueryClient } from '@tanstack/query-core'
import { beforeEach, describe, expect } from 'vitest'
import { injectIsFetching } from '../inject-is-fetching'
import { injectQuery } from '../inject-query'
import { provideAngularQuery } from '../providers'
import {
QueryClient,
injectIsFetching,
injectQuery,
provideAngularQuery,
} from '..'
import { delayedFetcher } from './test-utils'

describe('injectIsFetching', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { QueryClient } from '@tanstack/query-core'
import { beforeEach, describe } from 'vitest'
import { TestBed, fakeAsync, tick } from '@angular/core/testing'
import { injectIsMutating } from '../inject-is-mutating'
import { injectMutation } from '../inject-mutation'
import { provideAngularQuery } from '../providers'
import {
QueryClient,
injectIsMutating,
injectMutation,
provideAngularQuery,
} from '..'
import { successMutator } from './test-utils'

describe('injectIsMutating', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expectTypeOf } from 'vitest'
import { injectMutationState } from '../inject-mutation-state'
import type { MutationState, MutationStatus } from '@tanstack/query-core'
import { injectMutationState } from '..'
import type { MutationState, MutationStatus } from '..'

describe('injectMutationState', () => {
it('should default to QueryState', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Component, input, signal } from '@angular/core'
import { QueryClient } from '@tanstack/query-core'
import { TestBed } from '@angular/core/testing'
import { describe, expect, test, vi } from 'vitest'
import { By } from '@angular/platform-browser'
import { injectMutation } from '../inject-mutation'
import { injectMutationState } from '../inject-mutation-state'
import { provideAngularQuery } from '../providers'
import {
QueryClient,
injectMutation,
injectMutationState,
provideAngularQuery,
} from '..'
import { setFixtureSignalInputs, successMutator } from './test-utils'

const MUTATION_DURATION = 1000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expectTypeOf } from 'vitest'
import { injectMutation } from '../inject-mutation'
import { injectMutation } from '..'
import { successMutator } from './test-utils'
import type { Signal } from '@angular/core'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Component, input, signal } from '@angular/core'
import { QueryClient } from '@tanstack/query-core'
import { TestBed } from '@angular/core/testing'
import { describe, expect, vi } from 'vitest'
import { By } from '@angular/platform-browser'
import { injectMutation } from '../inject-mutation'
import { provideAngularQuery } from '../providers'
import { QueryClient, injectMutation, provideAngularQuery } from '..'
import {
errorMutator,
expectSignals,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expectTypeOf } from 'vitest'
import { injectQuery } from '../inject-query'
import { injectQuery } from '..'
import { simpleFetcher } from './test-utils'
import type { Signal } from '@angular/core'

Expand Down
Loading

0 comments on commit b7aaa03

Please sign in to comment.